Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prateekbh/preact-cli-sw-precache
Preact cli plugin for configuring sw-precache
https://github.com/prateekbh/preact-cli-sw-precache
preact preact-cli-plugin sw-precache
Last synced: about 2 months ago
JSON representation
Preact cli plugin for configuring sw-precache
- Host: GitHub
- URL: https://github.com/prateekbh/preact-cli-sw-precache
- Owner: prateekbh
- License: mit
- Created: 2017-07-19T07:12:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-03T05:35:50.000Z (about 7 years ago)
- Last Synced: 2024-04-24T21:00:50.664Z (8 months ago)
- Topics: preact, preact-cli-plugin, sw-precache
- Language: JavaScript
- Size: 5.86 KB
- Stars: 19
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# preact-cli-sw-precache
Preact cli plugin for configuring [sw-precache](https://github.com/GoogleChrome/sw-precache).This plugin allows you to customize the behaviour of auto bundled `sw-precache` module.
You can specify all the custom config that `sw-precache` accepts and hence make your service worker more powerful.## Getting started
```
npm i -D preact-cli-sw-precache
```## Example
In order to provide custom confguration, add the following code to preact.config.js. :point_down:```js
const preactCliSwPrecachePlugin = require('preact-cli-sw-precache');export default function (config) {
const precacheConfig = {
staticFileGlobs: [
'app/css/**.css',
'app/**.html',
'app/images/**.*',
'app/js/**.js'
],
stripPrefix: 'app/',
runtimeCaching: [{
urlPattern: /this\\.is\\.a\\.regex/,
handler: 'networkFirst'
}]
};return preactCliSwPrecachePlugin(config, precacheConfig);
}
```