Precompiled CSS not found in Rails 3.1 production mode

梦想与她 提交于 2019-12-04 22:43:06

If you want Rails to serve the static assets you have add the following line to your production.rb:

config.serve_static_assets = true

I understand it's better to allow apache or nginx to serve them, but this works if you are using a rails standalone server (or at least it works with thin)

So turns out that rails isn't responsible for serving the static assets that it precompiles. You must configure the web server you use (i.e. nginx) to serve those static assets for you instead of rails. I wish this was much clearer on the docs.

Could you please confirm that you have

<%= stylesheet_link_tag "application" %>

in the head segment in your application layout instead of something like:

<link href="/assets/application.css" media="screen" rel="stylesheet" type="text/css" />

This makes sure the precompiled application-xxx.css will be included.

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