Closed titanous closed 11 years ago
Great idea on the MD5... I guess I (and most people) never felt the issue as Git already assures consistent mtimes. Shall review it in the next few days.
I'd like to implement some sort of caching here, though. It seems it will do File.read
too many times. Perhaps some sort of cache with the filename+mtime as it's key would suffice (general idea being if the file is not modified, then it's MD5 won't change too).
Yeah, I noticed that and haven't gotten around to it. The app I'm using is heavily cached so it's not a big deal for me.
It'd be great to see some movement on this issue, it's something I'm interested in as well...
To me it looks like adding asset-host support to the helpers and being able to customize the hash algorithm for the cache buster are two separate issues. Other than that: I'd welcome both features! :)
on Heroku ENV['COMMIT_HASH'] returns the sha of the deployed version of the code.
Great, that must be newish, there have been requests for a while.
Any update on this?
This is, of course, far from a universal solution, but I discovered that CloudFlare (which replaces your nameservers) will automatically cache assets for you. Might be a reasonable interim solution for some.
+1
We're also interested in asset host configuration as well as the MD5 hash for cache-busting. We have an additional need to configure multiple asset hosts as well that are selected based on a hash of the file.
Added your commit to feature/md5-hosts branch. Some issues to be fixe before release but it should definitively make it soon. See #71 for ongoing discussion.
Allows setting an asset host like this:
Which will prefix all asset urls in production with
//cdn.example.org
. I've also changed the cache buster to MD5 so that files can be versioned properly on CDNs as the mtime is server-specific.Closes #4.