I also tried using digest in development and learned something: you can change an asset by moving one section of the file to another section and even though the file is thumbprinted/digested, sometimes the browser won't reload it.
Basically, I changed config/environments/development.rb to use:
config.assets.debug = false
config.assets.digest = true
and much of the time if I move one section of the file to another part of the same file (and I tried in a few different ways), the browser (FF 17 in OS X) won't reload the asset because it is still cached, even when I am forcing Sprockets to cache-bust via this patch in config/initializers/.../name_of_my_patch.rb
# Sprockets 2.x patch to cache-bust non-fingerprinted angular template html in development
if Rails.env.development?
module Sprockets
module Server
private
# want to attempt to be compatible as much as possible so we'll call their headers method 'sprockets_headers' and then
# override just the headers we want. this may or may not work in future versions as this is a private method.
alias_method :sprockets_headers, :headers
def headers(env, asset, length)
sprockets_headers(env, asset, length).tap do |headers|
# both digested/thumbprinted and non-digested files seem to not refresh cache (at least with FF 17)
# so, use cache-busters for .../app/assets/**/*
if asset.pathname.to_s['/app/assets/']
puts "cache-busting #{asset.pathname.to_s} etag_header=#{headers["ETag"]} path_fingerprint(env[\"PATH_INFO\"])=#{path_fingerprint(env["PATH_INFO"])}"
headers["Cache-Control"] = "max-age=0, private, must-revalidate"
end
end
end
end
end
end
However, with that patch, if I comment out the following:
#config.assets.debug = false
#config.assets.digest = true
It seems to work as intended.