parcel-plugin-workbox2
v0.0.5
Published
A plugin for Parcel to generate a service worker with Workbox
Downloads
3
Maintainers
Readme
parcel-plugin-workbox
A plugin for Parcel to generate a service worker with Workbox.
Install
You can either install by running yarn (recommended)
yarn add parcel-plugin-workbox --dev
or use npm
npm install parcel-plugin-workbox --save-dev
Usage
When you build resources with Parcel, the plugin will generate a service worker sw.js
that you can register in your web page:travi
<script>
// Check that service workers are registered
if ('serviceWorker' in navigator) {
// Use the window load event to keep the page load performant
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js');
});
}
</script>
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.