Reputation: 2575
I have the following line in my css file:
background-image: url(<%= image_path 'background.jpg' %>);
And it yields the following error:
Invalid CSS after "...und-image: url(": expected ")", was "<%= image_path ..."
I have also tried asset_path
, but it has the same results.
Upvotes: 1
Views: 456
Reputation: 4940
If you take a look at The asset pipeline, You can see that using image-url("background.jpg")
becomes url(/assets/background.jpg)
, which is what you want if you image is in your /app/assets/images
directory
So use
background-image: image-url("background.jpg")
Upvotes: 2