chore: update readme
This commit is contained in:
parent
707985cd01
commit
89caf380e1
2 changed files with 7 additions and 1 deletions
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
The integration accepts path to your own authored [service worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) and automatically injects dynamic variables such as `__assets` generated by Astro for caching. The goal is to let devs retain the flexibility for various [caching strategies](https://developer.chrome.com/docs/workbox/caching-strategies-overview/).
|
The integration accepts path to your own authored [service worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) and automatically injects dynamic variables such as `__assets` generated by Astro for caching. The goal is to let devs retain the flexibility for various [caching strategies](https://developer.chrome.com/docs/workbox/caching-strategies-overview/).
|
||||||
|
|
||||||
|
Other integrations exist which will generate a service worker for you, but [there are good reasons](https://developer.chrome.com/docs/workbox/modules/workbox-build#when_not_to_use_generatesw) to avoid this.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
In your [Astro](https://astro.build) project:
|
In your [Astro](https://astro.build) project:
|
||||||
|
@ -50,3 +52,7 @@ The integration accepts a configuration object of type `ServiceWorkerConfig` wit
|
||||||
## Example sw.js
|
## Example sw.js
|
||||||
|
|
||||||
You can find an example service worker (`example_sw.js`) in the [repository](https://ayco.io/gh/astro-sw), and here's the [raw file](https://raw.githubusercontent.com/ayoayco/astro-sw/main/example_sw.js) too.
|
You can find an example service worker (`example_sw.js`) in the [repository](https://ayco.io/gh/astro-sw), and here's the [raw file](https://raw.githubusercontent.com/ayoayco/astro-sw/main/example_sw.js) too.
|
||||||
|
|
||||||
|
## Example project
|
||||||
|
|
||||||
|
This was developed to support the needs of [Cozy](https://github.com/ayoayco/cozy).
|
2
index.js
2
index.js
|
@ -9,7 +9,7 @@ import { randomUUID } from "node:crypto";
|
||||||
* assetCachePrefix?: string,
|
* assetCachePrefix?: string,
|
||||||
* assetCacheVersionID?: string,
|
* assetCacheVersionID?: string,
|
||||||
* customRoutes?: Array<string>,
|
* customRoutes?: Array<string>,
|
||||||
* excludeRoutes?: Array<string,
|
* excludeRoutes?: Array<string
|
||||||
* }} ServiceWorkerConfig
|
* }} ServiceWorkerConfig
|
||||||
* @typedef {import('astro').AstroIntegration} AstroIntegration
|
* @typedef {import('astro').AstroIntegration} AstroIntegration
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue