我正在尝试将CSS框架Blueprint加载到我的Rails 3.1应用程序中。
在Rails 3.0+中,我会在我的视图/layouts/application.html.erb中有类似这样的内容:
<%= stylesheet_link_tag 'blueprint/screen', 'application' %>
<%= stylesheet_link_tag 'blueprint/print', 'media' => 'print' %>
<!--[if lt IE 8]>
<%= stylesheet_link_tag 'blueprint/ie' %>
<![endif]-->
然而,Rails 3.1 现在使用 SASS。那么正确的加载 Blueprint CSS 文件的方式是什么?
目前,我将 blueprint 文件夹放在 app/assets/stylesheets/ 下。
我的 app/assets/stylesheets/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 .
*/
我需要在application.css中做一些事情,以便加载必要的Blueprint文件吗?如果是这样,怎么做?
其次,如何提供一些条件来检查IE8,以加载blueprint/ie.css?
编辑:
嗯,重新加载应用程序的网页。Rails 3.1包括Blueprint文件。即使css文件在文件夹中(在这种情况下:app/assets/stylesheets/blueprint)。
这让我有两个问题
- 如何使用SASS应用 if lt IE 8 条件?
- 如何使用SASS为打印格式加载CSS文件(即<%= stylesheet_link_tag 'blueprint/print','media' => 'print' % >)?