Service Worker Builder
The sw-builder
package automates the creation of your Application's Service Worker, which pre-caches your build. This leads to a better overall performance and enables users to access your PWA without an Internet connection.
Getting Started
Install the package:
$ npm install -D sw-builder
Create the sw-builder.config.json
file in your project's root:
{
"outDir": "dist",
"template": "base",
"includeToPrecache": [
"/assets",
"/some-other-dir",
"/index.html",
"/logo.png",
"/splash.png"
],
"excludeFilesFromPrecache": [
"some-ignorable-file.woff2",
]
}
Include the sw-builder
binary in your package.json
file:
...
"scripts": {
"build": "sw-builder && tsc && ...",
"build": "sw-builder --config='sw-custom.config.json' && tsc && ...",
}
...
Built With
Running the Tests
$ npm run test:unit
$ npm run test:integration
License
MIT
Acknowledgments
Deployment
Install dependencies:
$ npm install
Build the project:
$ npm start
Publish to npm
:
$ npm publish