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

后端 未结 9 2113
一整个雨季
一整个雨季 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:15

    If you have updated your app to Rails 3.1 in the past, make sure you changed your application.rb file from

    # If you have a Gemfile, require the gems listed there, including any gems
    # you've limited to :test, :development, or :production.
    Bundler.require(:default, Rails.env) if defined?(Bundler)
    

    to

    if defined?(Bundler)
      # If you precompile assets before deploying to production, use this line
      Bundler.require *Rails.groups(:assets => %w(development test))
      # If you want your assets lazily compiled in production, use this line
      # Bundler.require(:default, :assets, Rails.env)
    end
    

    See this railscast on upgrading to Rails 3.1 and adding the asset pipeline.

    Update: Rails 4 goes back to the old way of doing it. Thanks Aaron Gray!

    # Require the gems listed in Gemfile, including any gems
    # you've limited to :test, :development, or :production.
    Bundler.require(:default, Rails.env)
    

提交回复
热议问题