alexyork / TrondheimDC-WebApp

TrondheimDC-WebApp
3 stars 1 forks source link

Work in offline mode #12

Open alexyork opened 12 years ago

yornaath commented 12 years ago

I have added manifest file generation in the backend. It traverses all the files in the public folder and generates a manifest file based on that. It then serves it with Last-Modified header set to the last updated files mtime and also a comment at the end to bust legacy caches.

It only works in production mode: that means NODE_ENV is set to production.

Localy you can do that by

export NODE_ENV=production
node app.js

I have also configured the heroku instance to run in production, that means when you have pushed to it, you may have to refresh the page two time bust the cache. At least in chrome v23.

yornaath commented 12 years ago

This should work now.

One question tough. When we make an update in a css/js, image or some other file in the manifest and a user that has previously visited our app visits it again. The latest change wont be reflected as the downloading of new content happens after the page renders.

One approach is to catch the "Updateready" event that is emitted after it is finished downloading and do a page refresh in javascript.

Thoughts?

hegerokenes commented 12 years ago

Commented out as loong as we are working on it, to avoid cache issues. Will be commented in on release.

alexyork commented 12 years ago

We should consider leaving this commented out permanently. Lots of bugs and unpredictable things seem to be happening due to offline caching. Also, it reduces our ability to push fast updates on the day of the conference, if there are any last minute changes...