chore: update readme
This commit is contained in:
parent
fb8a4699cb
commit
d44c39ce59
1 changed files with 19 additions and 3 deletions
22
README.md
22
README.md
|
@ -1,9 +1,21 @@
|
||||||
> **>>> TL;DR:** Simple Astro integration to use your own authored service-worker; by default, devs retain full control as opposed to getting generated sw code
|
> **>>> TL;DR:** Simple Astro integration to use your own authored service worker; by default, devs retain full control as opposed to getting generated sw code
|
||||||
|
|
||||||
# Astro SW
|
# Astro SW
|
||||||
|
|
||||||
The integration `serviceWorker` accepts configuration with service worker path and automatically injects needed dynamic variables such as `assets` generated by Astro for caching
|
The integration `serviceWorker` accepts configuration with service worker path and automatically injects needed dynamic variables such as `assets` generated by Astro for caching
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
In your [Astro](https://astro.build) project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# npm
|
||||||
|
$ npm i -D @ayco/astro-sw
|
||||||
|
|
||||||
|
# pnpm
|
||||||
|
$ pnpm add -D @ayco/astro-sw
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Example `astro.config.mjs`
|
Example `astro.config.mjs`
|
||||||
|
@ -34,5 +46,9 @@ The integration accepts a configuration object of type `ServiceWorkerConfig` wit
|
||||||
| property | type | required? | notes |
|
| property | type | required? | notes |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| path | string | required | path to your *own* service worker script; no surprises & easy debugging |
|
| path | string | required | path to your *own* service worker script; no surprises & easy debugging |
|
||||||
| assetCachePrefix | string | optional | cache storage name prefix; useful for debugging & invalidation |
|
| assetCachePrefix | string | optional | cache storage name prefix; useful for debugging |
|
||||||
| assetCacheVersionID | string | optional | cache storage name versioning; by default, a random UUID is used but you can provide your own for easy debugging |
|
| assetCacheVersionID | string | optional | cache storage name versioning; by default, a random UUID is used but you can provide your own for easy debugging & invalidation |
|
||||||
|
|
||||||
|
## 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.
|
Loading…
Reference in a new issue