exhibit-builder-sw-precache
v0.2.0
Published
Generates a service worker script using sw-precache
Downloads
3
Readme
sw-precache
Exhibit.js builder plugin
Generates a service worker using the Chrome team’s sw-precache template.
$ npm install -D exhibit-builder-sw-precache
Usage
.use('sw-precache', {cacheId: 'foo'})
This looks for cacheable files in your app, and then generates a service-worker.js
that will cache those files.
This plugin should go at the end of your build sequence, after all cacheable assets’ contents have been finalized – i.e. after any preprocessors, minifiers, compressers, etc.
Options
include
(string/array/function) — default:'**/*.{js,html,css,png,jpg,gif,svg}'
Chooses which files should be included in the service worker cache. Follows Exhibit’s glob convention.
filename
(string) — default:'service-worker.js'
The path for the generated service worker.
Additional options
If set, the following options are used to configure the sw-precache template:
cacheId
directoryIndex
handleFetch
ignoreUrlParametersMatching
importScripts
- ~~
maximumFileSizeToCacheInBytes
~~ not yet working navigateFallback
License
MIT