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 


Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts