2

Assuming a site with multiple long lived apps, are there some easy strategies for hot swapping javascript/css code in production?

I've seen some websites (pivotal tracker for instance) show a banner that says "there are updates, please refresh." Ideally, the solution would be more like liveupdate within a development environment. Does anything like that exist yet?

Parris
  • 17,833
  • 17
  • 90
  • 133
  • Or you can just use a cache buster, like Stack Overflow. – Fabrício Matté Feb 04 '14 at 04:32
  • The problem isn't caching. It's more about people never refreshing or changing pages and how to swap out their code for a newer version. – Parris Feb 04 '14 at 04:34
  • Well, cache busters used properly will ensure that a new page load will load the latest assets. If you want to notify users about new assets without navigating away/refreshing the page, you will need some kind of push service (websocket, server-sent events) or Ajax polling. – Fabrício Matté Feb 04 '14 at 04:36
  • Can you regularly (maybe every minute/hour/day) poll the server to see if there is a JS version update and then force a page refresh (i.e. `window.location.reload()`)? – Steve Feb 04 '14 at 04:37
  • Yea both of those don't sound too bad. If the user hasn't interacted in a while and there is an update maybe an auto refresh is ok. And if you simply show a banner after a release maybe that's ok too. – Parris Feb 04 '14 at 04:39
  • 1
    Refresh is preferable to trying to ensure all code refs are updated on the fly. Yuck. – Erin Ishimoticha Feb 04 '14 at 04:40

0 Answers0