Observed since 20 Oct, 18:06 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
An Eleventy plugin to generate service worker for PWA using Google Workbox
An Eleventy plugin to generate service worker. Using Google Workbox to generate service-worker.js based on your
dir.output.
Since (at this moment) eleventy doesn't have any API to do a things after build process, this plugin are using monkey patch method to wrap into the finish function in order to run workbox properly.
npm i eleventy-plugin-pwa
const pluginPWA = require("eleventy-plugin-pwa");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginPWA);
};
Read more about Eleventy plugins
// in your header templates
<script>
if ("serviceWorker" in navigator)
navigator.serviceWorker.register("/service-worker.js");
</script>
Read The Web App Manifest Guide
You can also pass workbox generateSW options directly into the plugin. For example :
// overwriting destination file and more
const pluginPWA = require("eleventy-plugin-pwa");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginPWA, {
swDest: "./build/sw.js",
globDirectory: "./build"
});
};
Read more about it on workbox generateSW module page
This code is available under the MIT license.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 2.0.0Registry latest | 14 Apr 2022 | 5 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 18:06 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:ae77a8696f5fe24e9e4c88707705f1f41fd9170a49a4a6e4ced4167a4bd58f5c