Skip to content

Instantly share code, notes, and snippets.

@camille-hdl
Created March 10, 2019 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camille-hdl/0f02f6be6f39f372c93d75300ba05a65 to your computer and use it in GitHub Desktop.
Save camille-hdl/0f02f6be6f39f372c93d75300ba05a65 to your computer and use it in GitHub Desktop.
importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js");
workbox.precaching.suppressWarnings();
// the following line will be replaced by workbox-cli
workbox.precaching.precacheAndRoute([]);
// Cache unpkg (for systemjs)
workbox.routing.registerRoute(
/^https:\/\/unpkg\.com/,
workbox.strategies.cacheFirst({
cacheName: "unpkg",
plugins: [
new workbox.cacheableResponse.Plugin({
statuses: [0, 200],
}),
new workbox.expiration.Plugin({
maxAgeSeconds: 60 * 60 * 24 * 365,
maxEntries: 30,
}),
],
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment