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

pull/2340/head
Noel Schnierer 4 years ago committed by GitHub
parent dcedd17f57
commit 2a20c44338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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