Go offline! Service Workers with Hugo

Yes I’m also looking for fails, so far I don’t have much experience but from my tryouts I have seen that it failed at one point (on a mobile phone in the Facebook browser on Android) as well as on Chrome on that phone (but did not happen on another phone and for chrome clearing the offline files resolved it). Theoretically it should update it whenever something in the ServiceWorker changes and from comparing different runs it seems like sw-precache is doing a good job in changing the hashes only for the changed content which should trigger updating the SW in the browser. Need to analyze the generated SW a bit more to see if it really handles clearing the local cache on updates well. I wonder how well it works for a bigger Hugo blog with dynamic caching. The ServiceWorker would need to take care of clearing the cache on changes but I still don’t know exactly the consequences of messing up the ServiceWorker badly and how to recover from that automatically.

2 Likes