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 |
|
20 | Add a call to `workbox.setConfig({modulePathPrefix: '...'})` to your service worker to use hosted workbox libraries.
|
21 |
|
22 | See https://goo.gl/Fo9gPX for further documentation.
|
23 |
|
24 | You have two options:
|
25 |
|
26 | ### Option 1: JSDelivr
|
27 |
|
28 | Use `https://cdn.jsdelivr.net/npm/workbox-cdn/workbox/workbox-sw.js`
|
29 |
|
30 | ### Option 2: NPM Package
|
31 |
|
32 | Install `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 | ```
|
37 | Copyright 2017 Google Inc.
|
38 |
|
39 | Licensed under the Apache License, Version 2.0 (the "License");
|
40 | you may not use this file except in compliance with the License.
|
41 | You may obtain a copy of the License at
|
42 |
|
43 | https://www.apache.org/licenses/LICENSE-2.0
|
44 |
|
45 | Unless required by applicable law or agreed to in writing, software
|
46 | distributed under the License is distributed on an "AS IS" BASIS,
|
47 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
48 | See the License for the specific language governing permissions and
|
49 | limitations under the License.
|
50 | ```
|