Created
January 27, 2019 21:13
-
-
Save MrPeker/00617c8b0f536360600a92270ffa0c96 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
workbox.routing.registerRoute( | |
// CSS dosyalarını önbellekle | |
/.*\.css/, | |
// Önbelleği kullan ama mümkün olduğunda arkaplanda güncelle | |
workbox.strategies.staleWhileRevalidate({ | |
// Özel önbellek ismi kullan | |
cacheName: 'css-cache', | |
}) | |
); | |
workbox.routing.registerRoute( | |
// Resim dosyalarını önbellekle | |
/.*\.(?:png|jpg|jpeg|svg|gif)/, | |
// Önbellek kullanılabilirse onu kullan | |
workbox.strategies.cacheFirst({ | |
// Özel önbellek ismi kullan | |
cacheName: 'image-cache', | |
plugins: [ | |
new workbox.expiration.Plugin({ | |
// Sadece 20 resimi önbellekte tut | |
maxEntries: 20, | |
// Önbellekte en fazla 1 hafta boyunca dursunlar | |
maxAgeSeconds: 7 * 24 * 60 * 60, | |
}) | |
], | |
}) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment