scss.erb ruby code not executing

本秂侑毒 提交于 2020-01-04 05:54:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!