Why does stylesheet_link_tag not link to /assets in production?

前端 未结 4 1960
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-30 06:40

I just did the first deploy for a new Rails 3.1 application, but the assets don\'t seem to work correctly. I\'m precompiling everything upon deploy, and it turns up in

4条回答
  •  醉梦人生
    2020-12-30 07:11

    WARNING: Setting config.assets.compile = true in production can make your app vulnerable to Rails Asset Pipeline Directory Traversal Vulnerability (CVE-2018-3760) .

    I would suggest you to enable config.assets.compile = false(by default) to true in production.rd and see the assets are served as in developemnt. If they are correctly served then you should check your application.css to see if you are including other stylesheets in the directory properly like having css files

    /*
    *= require scaffold
    *= require pagination
    *= require_self
    *= require_tree.
    */
    

    where scaffold and pagination are css files. or mention them under config.assets.precompile flag as below.

    config.assets.precompile += %w(pagination.css scaffold.css )

    I assume the reason being precompile works (application.js, application.css, and all non-JS/CSS are already added) and any additonal assets should be added to config.assets.precompile flag.

提交回复
热议问题