https://github.com/leafiy/parcel-plugin-sw-precache2
Another Parcel plugin for service-worker with full sw-precache configurations support.
https://github.com/leafiy/parcel-plugin-sw-precache2
parcel parcel-plugin pwa service-worker
Last synced: 2 months ago
JSON representation
Another Parcel plugin for service-worker with full sw-precache configurations support.
- Host: GitHub
- URL: https://github.com/leafiy/parcel-plugin-sw-precache2
- Owner: leafiy
- License: mit
- Created: 2018-03-22T18:11:07.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-04T17:49:27.000Z (about 7 years ago)
- Last Synced: 2025-08-27T13:26:20.156Z (7 months ago)
- Topics: parcel, parcel-plugin, pwa, service-worker
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# parcel-plugin-sw-precache2
Another Parcel plugin for service-worker with full `sw-precache` configurations
support.
Inspired by https://github.com/cyyyu/parcel-plugin-sw-precache.
## Installation
```
npm i -D parcel-plugin-sw-precache2
```
or
```
yarn add -D parcel-plugin-sw-precache2
```
## Configurations (add to your `package.json` in `sw` section)
#### fileName [String]
Custom name for the auto-generated file containing the service worker script.
Default: `service-worker.js`.
#### swSrc [String]
Merge your own service worker rules to the auto-generated file.
Default: `''`.
#### minify [Boolean]
Minifies the generated code.
Default: `true`.
#### cacheId[String]
A string used to distinguish the caches created by different web applications
that are served off of the same origin and path.
Default: `''`
### Other configurations
The plugin supports all the settings provided by **sw-precache**.
See fully configurations at https://github.com/GoogleChromeLabs/sw-precache.
##### Example
`package.json`:
```json
{
"name": "an-awesome-node-project",
"description": "An awesome project!",
"version": "1.0.0",
"main": "index.js",
"author": "",
"license": "MIT",
"devDependencies": {
"parcel-bundler": "^1.1.0"
},
"sw": {
"fileName": "sw.js",
"swSrc": "./path/to/sw.js",
"minify": true,
"cacheId": "awesome-cache"
}
}
```