Browse Source

fix: fonts not cached by service worker (#2338)

pull/2340/head
Noel Schnierer 5 years ago committed by GitHub
parent
commit
2a20c44338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/service-worker.js

9
src/service-worker.js

@ -36,3 +36,12 @@ workbox.routing.registerNavigationRoute( @@ -36,3 +36,12 @@ workbox.routing.registerNavigationRoute(
blacklist: [/^\/_/, /\/[^/?]+\.[^/]+$/],
},
);
// Cache relevant font files
workbox.routing.registerRoute(
new RegExp("/(fonts.css|.+.(ttf|woff2|otf))"),
new workbox.strategies.StaleWhileRevalidate({
cacheName: "fonts",
plugins: [new workbox.expiration.Plugin({ maxEntries: 10 })],
}),
);

Loading…
Cancel
Save