eleventy-plugin-pwa
eleventy-plugin-pwa copied to clipboard
network-first strategy
Is there a way to tell workbox that you want it to use the network-first strategy so it always attempts to load files from the network before getting them from the cache? It seems like this would be desirable while making changes to a site.
You can change the Workbox Strategy by adding the following to your .eleventy.js
file:
eleventyConfig.addPlugin( pluginPWA, {
runtimeCaching: [
{
urlPattern: /^.*\.(html|jpg|png|gif|webp|ico|svg|woff2|woff|eot|ttf|otf|ttc|json)$/,
handler: 'NetworkFirst'
},
{
urlPattern: /^https?:\/\/fonts\.googleapis\.com\/css/,
handler: 'NetworkFirst'
}
]
});
Same with any default options listed here:
https://github.com/okitavera/eleventy-plugin-pwa/blob/master/src/builder.js