Re:Show HN: Angular 2 HN – A progressive Hacker News client ...
by dkrvt on Wednesday December 28, 2016 @01:16AM
(#13268793)
It's using a library to generate one on the fly: https://github.com/GoogleChrome/sw-precache
Re:Show HN: Angular 2 HN – A progressive Hacker News client ...
by MrAwesomeSauce on Wednesday December 28, 2016 @03:20AM
(#13269212)
Yep, like dkrvt mentioned I'm using sw-precache to generate the server worker file. The file in my root folder that you're seeing is sort of a placeholder which gets copied to the actual bundle folder that gets deployed (you don't see it in the GitHub repo, you'll need to build the app locally [ng build --prod] to generate it]. sw-precache then lets me run a simple command which sets up the service worker on the fly based on some simple configurations.
Here's an excellent article btw that helped me understand how to set up sw-precache with an Angular CLI app (https://coryrylan.com/blog/fast-offline-angular-apps-with-se...)
btw I am trying to learn service workers and wanted to check how you have implemented the offline support, but when I checked
https://github.com/hdjirdeh/angular2-hn/blob/master/src/serv... it's empty .. am I missing something ?