UNPKG

2.09 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://developers.google.com/web/tools/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 2017 Google Inc.
38
39Licensed under the Apache License, Version 2.0 (the "License");
40you may not use this file except in compliance with the License.
41You may obtain a copy of the License at
42
43 https://www.apache.org/licenses/LICENSE-2.0
44
45Unless required by applicable law or agreed to in writing, software
46distributed under the License is distributed on an "AS IS" BASIS,
47WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48See the License for the specific language governing permissions and
49limitations under the License.
50```