application.css not being served as an asset

前端 未结 3 3267
遇见更好的自我
遇见更好的自我 2021-02-20 18:52

EDIT 4, 5 and 6

8 hours in, any more ideas are welcome :) Maybe this bug is already known and solved, but I get the behaviour I described in edit 2&

相关标签:
3条回答
  • 2021-02-20 19:35

    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.

    0 讨论(0)
  • 2021-02-20 19:38

    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.

    0 讨论(0)
  • 2021-02-20 19:51

    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.

    0 讨论(0)
提交回复
热议问题