Add fonts to service-worker workbox cache

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-06-18 18:41:09 +02:00
parent 8b90aa0775
commit 637c7055c7
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -42,10 +42,11 @@ registerRoute(
// Cache CSS, JS, and Web Worker requests with a Stale While Revalidate strategy // Cache CSS, JS, and Web Worker requests with a Stale While Revalidate strategy
registerRoute( registerRoute(
// Check to see if the request's destination is style for stylesheets, script for JavaScript, or worker for web worker // Check to see if the request's destination is style for stylesheets, script for JavaScript, font, or worker for web worker
({ request }) => ({ request }) =>
request.destination === "style" || request.destination === "style" ||
request.destination === "script" || request.destination === "script" ||
request.destination === "font" ||
request.destination === "worker", request.destination === "worker",
// Use a Stale While Revalidate caching strategy // Use a Stale While Revalidate caching strategy
new StaleWhileRevalidate({ new StaleWhileRevalidate({