" ... kground-color:":预期表达式(例如1px,粗体)之后的无效CSS是" @ gray-lightest;"

时间:2017-08-21 03:40:40

标签: css ruby-on-rails

您好我正在学习rails,我突然在我的新项目中收到此错误消息,

" ... kground-color:":预期表达式(例如1px,粗体),是" @ gray-lightest;"

这是我的Application.scss

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 */


 @import "bootstrap-sprockets";
 @import "bootstrap";
 @import "home.scss"

然后我有一个home.scss

 @gray-lightest: lighten(#000, 97.25%);

 body {
     background-color: @gray-lightest;
 }

我的宝石文件

gem 'sass-rails',  '5.0.6'
gem 'bootstrap-sass', '3.3.7'
gem 'jquery-rails', '4.3.1'
gem 'haml-rails'

我已经看过sass解决方案,但我想使用scss或css。我尝试过更新捆绑包和所有宝石。我的其他项目做得很好。这次我怎么可能做错了?为什么我会收到此错误?是.scss扩展无法正常工作?谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

SCSS支持此语法来设置变量:

$gray-lightest: lighten(#000, 97.25%);

body {
     background-color: $gray-lightest;
}