documentcloud / jammit

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

The mtime of CSS packages does not consider embedded paths #191

Open mitio opened 13 years ago

mitio commented 13 years ago

When creating packages from CSS files, the mtime of the resulting file is set to the latest mtime of all files included in the package (plus the mtime of the Jammit config).

However, this does not take into account the mtimes of eventual embedded media files in the aforementioned CSS. If, for example, one updates an embedded image, the mtime of the resulting CSS package will not be changed properly and although the packaged CSS content changes, the mtime of the package will not reflect this change. Thus, the updated embedded image may not show up properly due to it being cached and referenced with an old ?<mtime> value.

As for a solution — I would not vote for removing this "latest mtime" feature. Instead, I would rather have a change in the packager implemented so that the compressor can tell what is the "latest mtime" of a given package/file, because the compressor knows how to check the mtimes of embedded assets.

In my opinion (and in some of our usecases), this is a must-have feature, because we generate and pre-cache packages (incl. CSS ones) at deploy time and removing it will mean that on each deploy our entire cache will get invalidated, which seems wasteful (esp. if you deploy often).

See here for details: https://github.com/documentcloud/jammit/commit/d706038dfec55d4bd52778839bf6169100a9ae47#commitcomment-482474