Rails: How to reference images in CSS within Rails 4

There’s a strange issue with Rails 4 on Heroku. When images are compiled they have hashes added to them, yet the reference to those files from within CSS don’t have the proper name adjusted. Here’s what I mean. I have a file called logo.png. Yet when it shows up on heroku it is viewed as:

/assets/logo-200a00a193ed5e297bb09ddd96afb953.png

However the CSS still states:

background-image:url("./logo.png");

The result: the image doesn’t display. Anybody run into this? How can this be resolved?

17 Answers
17

Leave a Comment