Html css

Css Background Images For Rails Production Environment

Posted by Weston Ganger on July 07, 2014

I was originally using the css rule background:url('image.png'); this does not work in Rails for production

The fix is to use one of the following:

background:image-url('image.png');

or

background:asset-url('image.png');

Take note that this only works when the image is located in app/assets/images/

If the image is an attachment to a model and is not being stored in the assets directory then you must use the original:

background:url('image.png');

Posted in HTML / CSS and Tagged with css rails 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts