This is a ServiceWorker template to turn small github pages into offline ready app.
Whenever I make make simple tools and toys, I create github repo and make a demo page using github pages. (like this)
Often these "app" are single index.html with all the nessesary CSS and JavaScript in it. I wanted to cache these html files so that I can access my tools offline as well.
Persoanl github pages are hosted under one root domain (i.e https://kosamari.github.io/[name of repo]). This caused some stumblings...
- When deleting outdated caches for the app,
caches.keys()returns all the caches under the domain. We need to filter and delete only caches associated with the app. - Path for ServiceWorker shoudld be specified in absolute path

Thanks for this! Works perfectly.