Rails asset pipeline - image_path helper only working in development

后端 未结 2 1565
名媛妹妹
名媛妹妹 2021-01-14 04:17

I have a problem with asset preocompilation in Rails (3.2.7).

I am including an favicon like this:



        
2条回答
  •  失恋的感觉
    2021-01-14 04:32

    You must tell Rails which assets are to be precompiled. You do this in config/application.rb or config/environments/production.rb with the config.assets.precompile config key.

    Rails starts with a default list of assets to precompile, including ["application.js", "application.css"], but if you want your own assets to be precompiled too, you have to add them to the list.

    For example:

    # config/application.rb
    module MyApp
      class Application < Rails::Application
        # other config ...
    
        config.assets.precompile += ["screen.css", "*.png"]
      end
    end
    

提交回复
热议问题