sass-rails helpers “image-url”, “asset-url” are not working in rails 3.2.1

后端 未结 9 2095
一整个雨季
一整个雨季 2020-12-12 20:36

I am on 3.2.1, with sass-rails-3.2.4 and sass-3.1.15...

The documentation for the asset pipeline says:

asset-url(\"rails.png\", image) becomes url(/a         


        
9条回答
  •  独厮守ぢ
    2020-12-12 21:07

    When I hit this problem, it was because I had not included the css file in the asset pipeline for pre-compilation. As a result, it would be generated at runtime. Because the sass-rails gem is commonly in the :assets group, the helpers are unavailable when generating css files at runtime.

    Try adding the following line to your application.rb (or production.rb):

    config.assets.precompile += %w( public/omg.css )
    

    I found the fix on this post including a gotcha around naming the files when adding them to the precompiler.

提交回复
热议问题