🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@piraces/eleventy-plugin-pwa

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@piraces/eleventy-plugin-pwa

An Eleventy plugin to generate service worker for PWA using Google Workbox

latest
Source
npmnpm
Version
1.1.2
Version published
Maintainers
1
Created
Source

@piraces/eleventy-plugin-pwa

license: MIT eleventy code style: prettier codecov

An Eleventy plugin to generate service worker. Using Google Workbox to generate service-worker.js based on your dir.output.

Note

This is a fork of the original work of @okitavera in eleventy-plugin-pwa, providing up-to-date support with the latest versions of Workbox, Eleventy and other related dependencies (in order to use the latest features and advancements of these tools).

Installation

npm i @piraces/eleventy-plugin-pwa

Add to eleventy config file

const pluginPWA = require("@piraces/eleventy-plugin-pwa");
module.exports = function(eleventyConfig) {
  eleventyConfig.addPlugin(pluginPWA);
};

Read more about Eleventy plugins

Registering Service Worker

// in your header templates
<script>
  if ("serviceWorker" in navigator)
    navigator.serviceWorker.register("/service-worker.js");
</script>

Adding Web App Manifest

Read The Web App Manifest Guide

Options

You can also pass workbox generateSW options directly into the plugin. For example :

// overwriting destination file and more
const pluginPWA = require("@piraces/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

License

This code is available under the MIT license.

Keywords

eleventy-plugin

FAQs

Package last updated on 31 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts