documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.com/jammit/
MIT License
1.16k stars 197 forks source link

Set the mtime of pre-cached files to the mtime of the newest file from the corresponding package #175

Closed mitio closed 13 years ago

mitio commented 13 years ago

Disclaimer: As this is my first pull request and even one of the very few times I've even pushed to GitHub, please let me know if I'm doing something in a wrong way.

I've made a small change to Jammit::Packager#precache_all, which should set the mtime of the resulting cached package file to the mtime of the newest file in the package which is being processed. This change should affect only pre-caching via the jammit command (or any code which uses Jammit.package!).

I think that this way we will preserve correct invalidation but will minimize occasions when the pre-cached content is being cache-invalidated in browsers because of, say, pre-caching during deployment. This would be advantageous in case your source files have correct mtimes after deployment (which is the case when you svn export, for example).

All comments are welcome.

mitio commented 13 years ago

I just saw the very same thing in the following commit, but implemented a bit differently: cws125/jammit@931e54d

jashkenas commented 13 years ago

Oops -- merged this, but the mtime implementation you linked to looks a little less invasive -- making the change.

jashkenas commented 13 years ago

Alright -- the two approaches are sort of fused in that last commit. Thanks for building this.