Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign 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

latest
Source
npmnpm
Version
0.0.5
Version published
Weekly downloads
11
266.67%
Maintainers
1
Weekly downloads
 
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