Rails 关于 scss 加载后所涉及的范围

xoxoj · April 19, 2012 · Last by xoxoj replied at April 19, 2012 · 2615 hits

rails 里 application.html.erb 里面有如下一段代码

<head>
  <title><%= full_title(yield(:title)) %></title>
  <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
</head>

其中<%= stylesheet_link_tag "application", :media => "all" %>

会把 stylesheet 目录下的所有 scss 样式都加载,可是某些 html 页面,我不需要加载其中的.scss 样式,该如何处理呢?

补充一下,可能我描述的不够清楚,例如共有 3 个 scss(a.scss b.scss c.scss),有两个页面 first.html.erb second.html.erb 如果是默认的方式加载 scss 的话,first.html.erb 和 second.html.erb 都会包含 a.scss,b.scss,c.scss 这 3 个样式,可是我 second.html.erb 里不需要 b.scss 这个样式呢。

那些页面单独调用

Unknow user #3 April 19, 2012

哈哈,我来逛逛

@huacnlee second.html.erb 单独调用?怎么个操作法啊!谢谢

看 Ruby China 代码的 application.html.erb 和 views/topics/_base.html.erb

好的,谢谢提醒!

搞定了,谢谢大家!

You need to Sign in before reply, if you don't have an account, please Sign up first.