Rails 3.1 asset urls in SCSS files do not seem to be referencing the assets correctly

余生长醉 提交于 2019-12-04 17:23:15

You may try:

.foo {
  background: url("/assets/foo.png")
}

should work fine. Hope it helps :)

try

.classname{
  background: url(asset_path('/assets/image.png'))
}

I have tried various solutions. The most elegant one was the following:

.foo {
   background-image: url('foo.png')
}

which automatically converted to url('/assets/foo.png') by the SCSS compiler.

.foo {
  background-image: asset-url('sub_dir/foo.png', asset);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!