For example, in my Rails application I have something like:
.wax_seal {
background: url("wax-seal-small.png");
display: block;
height: 100px;
margin: 0 auto;
width: 92px;
}
.wax_seal:active {
background: url('wax-seal-small-broken.png');
}
And in my config/environments/production.rb
file:
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = true
I manually invoke the compiling of assets:
bundle exec rake assets:precompile
And the files are created with hashes at the end of the name:
wax-seal-small-Uuhqwduhqwdoi234983jewf.png
So this doesn't work:
background: url("wax-seal-small.png");
But this works fine (when I manually type it in Chrome):
background: url("wax-seal-small-Uuhqwduhqwdoi234983jewf.png");
What step am I missing here? How can I make my CSS rules add in that little hash?
Adding config.assets.compile = true
in config/environments/production.rb
makes it work, but I read in the Rails guide that it's a bad practice due to significant performance hits.