UNPKG

2.58 kBMarkdownView Raw
1# Workbox Unofficial CDN
2
3[![automated](https://flat.badgen.net/badge/publish/automated/green)](#)
4[![circle ci](https://flat.badgen.net/circleci/github/nuxt-community/workbox-cdn)](https://circleci.com/gh/nuxt-community/workbox-cdn)
5[![npm version](https://flat.badgen.net/npm/v/workbox-cdn)](https://www.npmjs.com/package/workbox-cdn)
6[![npm downloads](https://flat.badgen.net/npm/dt/workbox-cdn)](https://www.npmjs.com/package/workbox-cdn)
7[![install size](https://flat.badgen.net/packagephobia/install/workbox-cdn)](https://packagephobia.now.sh/result?p=workbox-cdn)
8[![](https://data.jsdelivr.com/v1/package/npm/workbox-cdn/badge)](https://www.jsdelivr.com/package/npm/workbox-cdn)
9
10[Workbox](https://github.com/GoogleChrome/workbox) Unofficial CDN and standalone NPM package.
11
12## Why?
13
14- Having public usage/download stats
15- The `local` type costs `~8M` install size for `workbox-cli` package vs `< 1Mb` of this package
16- Default workbox CDN is hosted on `storage.googleapis.com` which is sometimes unavailable
17
18## Usage
19
20Add a call to `workbox.setConfig({modulePathPrefix: '...'})` to your service worker to use hosted workbox libraries.
21
22See https://goo.gl/Fo9gPX for further documentation.
23
24You have two options:
25
26### Option 1: JSDelivr
27
28Use `https://cdn.jsdelivr.net/npm/workbox-cdn/workbox/workbox-sw.js`
29
30### Option 2: NPM Package
31
32Install `workbox-cdn` package with `yarn add workbox-cdn` or `npm i workbox-cdn` and integrate it with your own build system or serve contents of `workbox` dir
33
34## License
35
36```
37Copyright 2018 Google LLC
38
39Permission is hereby granted, free of charge, to any person obtaining a copy
40of this software and associated documentation files (the "Software"), to deal
41in the Software without restriction, including without limitation the rights
42to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43copies of the Software, and to permit persons to whom the Software is
44furnished to do so, subject to the following conditions:
45
46The above copyright notice and this permission notice shall be included in
47all copies or substantial portions of the Software.
48
49THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
55THE SOFTWARE.
56```