Cache Google Fonts - Webpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Google Fonts stil dosyalarını Stale While Revalidate stratejisi ile önbellekleyin | |
workbox.routing.registerRoute( | |
/^https:\/\/fonts\.googleapis\.com/, | |
workbox.strategies.staleWhileRevalidate({ | |
cacheName: 'google-fonts-stylesheets', | |
}), | |
); | |
// Google Fonts webfont dosyalarını Cache First stratejisiyle bir yıllığına önbellekleyin | |
workbox.routing.registerRoute( | |
/^https:\/\/fonts\.gstatic\.com/, | |
workbox.strategies.cacheFirst({ | |
cacheName: 'google-fonts-webfonts', | |
plugins: [ | |
new workbox.cacheableResponse.Plugin({ | |
statuses: [0, 200], | |
}), | |
new workbox.expiration.Plugin({ | |
maxAgeSeconds: 60 * 60 * 24 * 365, | |
}), | |
], | |
}), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment