问题
I am trying to load a background image which is stored on Rackspace's CloudFiles in my Stylesheet file. I used Fog & CarrierWave to upload the image file and to call the file. I keep on getting this error:
Invalid CSS after "...und-image: url(": expected ")", was "<%= design.main..."
preview.css.scss.erb:
html{
background-image: url(<%= design.main_image_url.to_s %>);
}
Update: I rephrase my question and I got an answer from here
What I should have ask was "How to pass an instance variable to assets?" - Which you can can't
回答1:
Put the url in quotes.
url('<%= design.main_image_url.to_s %>');
来源:https://stackoverflow.com/questions/8745129/scss-erb-ruby-code-not-executing