Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

network-first strategy #5

Open
mvolkmann opened this issue Apr 11, 2020 · 1 comment
Open

network-first strategy #5

mvolkmann opened this issue Apr 11, 2020 · 1 comment

Comments

@mvolkmann
Copy link

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.

@thedigitalman
Copy link

thedigitalman commented Sep 10, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants