【问题标题】:scss style sheets issue rails 3.1scss 样式表问题 rails 3.1
【发布时间】:2011-11-25 06:08:54
【问题描述】:

我的 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 文件吗?

【问题讨论】:

  • 你能把整个application.css加起来吗?
  • 我已经在上面提供了我的 application.css

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


【解决方案1】:

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 . 
*/

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

【讨论】:

  • @KamrulHassan 那你能接受我的回答吗?您还应该回到其他问题并接受解决方案。对于可能出现在此页面上的其他人来说,它会更清楚,它会给你带来声誉 ;-)
猜你喜欢
  • 2011-10-18
  • 1970-01-01
  • 1970-01-01
  • 2011-11-28
  • 1970-01-01
  • 2012-05-19
  • 1970-01-01
  • 2016-03-05
  • 2011-09-18
相关资源
最近更新 更多