application.css not being served as an asset

坚强是说给别人听的谎言 提交于 2019-12-04 02:18:20

I had the exact same issue, and solved it by changing this option to true (it is at false by default) in my production.rb file.

  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = true

From what I understand, setting this option to false makes sense if you are running under Apache or nginx, which was not my case.

I had this issue the other day and solved it by editing the production.rb file

config.assets.compress = true
config.assets.compile = true
config.assets.digest = true
config.assets.initialize_on_precompile = false

Are the asset settings I ended up with. I precompile my assets, while deploying with capistrano.

Before I edited the asset settings, I had exactly the same issue. The .css was being requested and was compiled into my public/assets folder but the server couldnt find the files.

To keep things simple I like to use the .css.scss exstension and use:

li {
    background-image: image-url("logo_80px_80px.png");
}

Full reference can be found on Rails Guides under Section 2.2.2.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!