问题描述
我是Ruby新手,使用ruby 1.9.2P180和Rails 3.1.0.rc2
我在my_app_root / public / stylesheets / screen.css和我的application.html.erb
<%= stylesheet_link_tag'screen.css',:media => ; 'screen'%>根据应该工作,但我的rails服务器说:我在这里做错了什么?
提前感谢
解决方案默认3.1安装,使用新的基于链轮的资产管道。
将您的样式表放入/ app / assets / stylesheets并使用
<%= stylesheet_link_tag'application.css'%>
您的观看次数
==
或者,您也可以使用此文件夹中的所有样式表将其自动编译为单个文件。你可以设置在你的application.rb中关闭新的pipline。
config.assets.enabled = false
I am new to Ruby, using ruby 1.9.2P180 and Rails 3.1.0.rc2
I have "screen.css" in my_app_root/public/stylesheets/screen.css and in my application.html.erb
<%= stylesheet_link_tag 'screen.css', :media => 'screen' %>
according to here it should work but my rails server says:
What am I doing wrong here?
Thanks in advance
解决方案 Nothing, you are just using a default 3.1 install which uses the new sprockets-based asset pipeline.
put your stylesheets into /app/assets/stylesheets and use
<%= stylesheet_link_tag 'application.css' %>
in your views
the new pipeline takes all the stylesheets in that folder and automagically compiles them into a single file.
==
Alternatively, you can set turn the new pipline off in your application.rb with
config.assets.enabled = false
这篇关于Ruby on Rails在资源中查找css,而不是public / stylesheets的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!