scss样式表发行rails 3.1

时间:2011-09-26 14:01:16

标签: stylesheet ruby-on-rails-3.1 sass

我的projects.css.scss文件看起来像是下面的文件,

// Place all the styles related to the Projects controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

$right-container-background: #3BBFCE;
$right-container-padding: 2px;

.right-container{
    background-color: $right-container-background;
    color: white;
    padding-left: $right-container-padding;
    padding-right: $right-container-padding;
 }

它表示所有样式都会自动添加到您的application.css中。

但是如果不导入application.css我就无法使用它 即。

@charset "utf-8";
@import "projects.css.scss";
@import "partners.css.scss";

所以,虽然我在我的视图的项目部分,是否不会加载在application.css中导入的所有.scss文件?

1 个答案:

答案 0 :(得分:2)

rails 3.1中的默认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 . 
*/

如果您想要包含所有内容的默认行为,则应重新添加它们。