0

我想在rails3应用程序中订购我的样式表,但是我有一个使用* stylesheet_link_tag * helper重复自己的行的问题。css重复使用stylesheet_link_tag

在应用程序/视图/布局/ application.html.erb

<%= stylesheet_link_tag :reset, :application, :event_calendar, :cache => false %> 

在产生源代码:应用程序/资产/样式表/文件夹的

<link href="/assets/reset.css?body=1" media="screen" rel="stylesheet" type="text/css" /> 
<link href="/assets/application.css?body=1" media="screen" rel="stylesheet" type="text/css" /> 
<link href="/assets/event_calendar.css?body=1" media="screen" rel="stylesheet" type="text/css" /> 
<link href="/assets/reset.css?body=1" media="screen" rel="stylesheet" type="text/css" /> 
<link href="/assets/event_calendar.css?body=1" media="screen" rel="stylesheet" type="text/css" /> 

内容:

calendar (master *)$ ls app/assets/stylesheets/ 
application.css  event_calendar.css reset.css 

使用* javascript_include_tag * helper会出现同样的问题,我认为两者都有关系。

回答

2

如果您正在使用的管道资产只需要包括application.css因为里面应该有线条状...

/* 
* This is a manifest file that'll automatically include all the stylesheets available in this directory 
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at 
* the top of the compiled file, but it's generally better to create a new file per style scope. 
*= require_self 
*= require_tree . 
*/ 

不要被实际上它注释掉所迷惑,这将是因为require_tree .命令会自动将所有文件包含在同一个目录中。

只要把...

<%= stylesheet_link_tag :application, :cache => false %> 

可以内application.css指定的顺序,如果你需要你的reset.css先来

*= require reset 
*= require_self 
*= require_tree .