0
votes

My .css.erb file uses the asset_path helper to add image urls like so:

background: url(<%= asset_path('bg_image.gif') %>);

I would expect the asset_path helper to append a md5 fingerprint, like it does in the view files when doing rake assets:precompile. But in the compiled css the url simply becomes:

background: url(/assets/bg_image.gif)

That way loading of images referenced from css works but is slow. I'd like the css to used the fingerprinted versions obviously.

Anybody know what the issue is? Maybe I need to file a bug with rails.

1

1 Answers

0
votes

Okay, I recompiled my assets with bundle exec rake assets:precompile RAILS_ENV=production and it works now!

I used to simply do rake assets:precompile locally, as I read that precompile uses the production environment as a default. However, that doesn't seem to be the case.

(I have to precompile locally as I'm on Heroku)