Reputation: 5567
Currently, I have a external CSS library that I'm including in my rails app with the following structure
lib/
assets/
theme/
css/
*.css
images/
*.img
The CSS files refer to some images as follow:
background: #fff url("../images/image1.png") repeat;
This works fine locally, but when I deploy to Heroku this relative path ends up being:
...root_url/image1.png which doesn't work.
I could update all the image references to point to assets/ AND move the images there, but that seems tedious and I would prefer not to modify the CSS files since they are external.
Is there an easier way to accomplish this?
Upvotes: 2
Views: 313
Reputation: 19145
If you're using SASS, you have access to the asset-pipeline helpers, like:
background: #fff url(asset-path('image1.png'));
If you don't have SASS or a pre-processor, you can use the non-versioned asset path directly:
background: #fff url('/assets/image1.png'));
Upvotes: 1