config.assets.compile=true in Rails production, why not?

前端 未结 7 1892
闹比i
闹比i 2020-11-22 07:17

The default Rails app installed by rails new has config.assets.compile = false in production.

And the ordinary way to do things is to run

7条回答
  •  情书的邮戳
    2020-11-22 08:01

    To have less overhead with Pre-compiling thing.

    Precompile everything initially with these settings in production.rb
    # Precompile *all* assets, except those that start with underscore
    config.assets.precompile << /(^[^_\/]|\/[^_])[^\/]*$/
    

    you can then simply use images and stylesheets as as "/assets/stylesheet.css" in *.html.erb or "/assets/web.png"

提交回复
热议问题