I'm writing a web application which will likely be updated frequently, including changes to css and js files which are typically cached aggressively by the browser.
In order for changes to become instantly visible to users, without affecting cache performance, I've come up with the following system:
Every resource file has a version. This version is appended with a ? sign, e.g. main.css becomes main.css?v=147. If I change a file, I increment the version in all references. (In practice I would probably just have a script to increment the version for all resources, every time I deploy an update.)
My questions are:
- Is this a reasonable approach for production code? Am I missing something? (Or is there a better way?)
- Does the question mark introduce additional overhead? I could incorporate the version number into the filename, if that is more efficient.
Aucun commentaire:
Enregistrer un commentaire