CSS 行使用 stylesheet_link_tag 重复
我正在尝试在 Rails3 应用程序中订购样式表,但我遇到了使用 *stylesheet_link_tag* 帮助程序重复行的问题。
在 app/views/layouts/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" />
app/assets/stylesheets/ 文件夹的内容:
calendar (master *)$ ls app/assets/stylesheets/
application.css event_calendar.css reset.css
使用 *javascript_include_tag* 帮助程序出现同样类型的问题,我认为两者都可以相关。
I'm trying to order my stylesheets in a rails3 app, but I've got an issue with the lines repeating themselves using the *stylesheet_link_tag* helper.
In app/views/layouts/application.html.erb
<%= stylesheet_link_tag :reset, :application, :event_calendar, :cache => false %>
In produced source code:
<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" />
Content of app/assets/stylesheets/ folder:
calendar (master *)$ ls app/assets/stylesheets/
application.css event_calendar.css reset.css
The same kind of problem appears using *javascript_include_tag* helper, I think both can be related.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用资产管道,您只需要包含
application.css
,因为里面应该有这样的行...不要被注释掉的事实所迷惑,这将被处理并由于
require_tree .
命令,将自动包含同一目录中的所有文件。只需放入...
如果您需要将
reset.css
放在第一位,您可以在application.css
中指定顺序If you're using the asset pipeline you only need include
application.css
as inside that there should be lines like...Don't be fooled by the fact its commented out, this will be processed and will automatically include all the files in the same directory because of the
require_tree .
command.Just put...
You can specify the order within
application.css
if you need yourreset.css
to come first