sass-rails asset pipeline: generating image paths incorrectly; `url(/images/blah.png)` instead of `url(/assets/blah.png)`

前端 未结 8 987
南笙
南笙 2021-01-01 17:31

In section 2.2.2, \"CSS and Sass\", I\'m told to put image-url(\'delete.png\') in my sass. And so I have.

However, it is generating CSS like

<         


        
8条回答
  •  北海茫月
    2021-01-01 18:01

    If you do not have this already, name your css file *.css.scss (as opposed to .sass - if you do this, you might need to adjust the syntax of some statements). Then use the image_path helper instead of image-path, e.g.:

    background-image:url(image_path('delete.png'));
    

    I expect this to solve your issue. If it does not, what is the asset path generated by this approach for you?

提交回复
热议问题