webhintio / webhintio.github.io

🌍 webhint's website
https://webhint.io
Apache License 2.0
143 stars 72 forks source link

Re-add service worker #362

Open molant opened 6 years ago

molant commented 6 years ago

Because the service worker is in the root right now we are not cache busting it nor adding the right cache-control header. We should find a way to do this.

qzhou1607-zz commented 6 years ago

@molant The cache-control header is set to no-cache in the sonarwhal-worker. What's the "right" cache-control header value that it should be changed to? It doesn't seem right to me to set a max-age for the service worker since the content is mutable.

molant commented 6 years ago

I think that if you move the scripts to /static/scripts the gulp task should take care of updating the file names and the html that points to it.

Malvoz commented 6 years ago

Here's a couple of pointers, I hope they'll be of help if/when you decide to reintroduce service workers again:

For webhint-worker.js:

For sw-reg.js: