Socket
Book a DemoInstallSign in
Socket

gitbook-plugin-workbox

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitbook-plugin-workbox

A plugin for Gitbook that generates a service worker By using Workbox

0.0.5
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Gitbook Workbox Plugin

This plugin uses Workbox - a module written by Google - to automatically generate a service worker and include it in your gitbook output.

Installing

Add this to your gitbook by including it in your book.json file.

{
    "plugins": ["workbox"]
}

Be sure to run gitbook install before building your book, or as part of your automated build process.

Usage

Create workbox-config.js in the root directory (Maybe there is a package.json in the root directory)

Like the following.

module.exports = {
    cacheId: "hoge",
    globPatterns: [
        "**/*.{html,js,css}"
    ],
    clientsClaim: true,
    runtimeCaching: [
        {
            urlPattern: /\.(jpg|png|svg|gif|woff|ttf|eot)/,
            handler: "cacheFirst",
            options: {
                cacheName: "assets",
                expiration: {
                    maxAgeSeconds: 60 * 60 * 24 * 14
                }
            }
        },
    ],
};

Caution!!

This plugin already set globDirectory and swDest.
(Confirm index.js)

{
  globDirectory: "_book",
  swDest: "_book/service-worker.js",
}

So, if you overwrite this setting, please add your original setting in workbox-config.js

License

This plugin is released under the MIT License, please see LICENSE.

Keywords

gitbook

FAQs

Package last updated on 14 May 2018

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.