diff --git a/src/service-worker.js b/src/service-worker.js index 14da5bd2..b84e88f6 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -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 })], + }), +);