Sass :: SyntaxError未定义变量 [英] Sass::SyntaxError Undefined Variable

查看:1574
本文介绍了Sass :: SyntaxError未定义变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Asset Pipeline的新手,所以如果我做错了事,请告诉我.

I'm new to the Asset Pipeline, so let me know if I'm doing things wrong.

在Rails 3.2中使用SASS.我有一个配置部分,它定义了我想在整个scss文件中使用的一堆SASS变量.根据本指南,我首先导入configuration,然后导入bonus.但是,我在Bonus.css.scss中不断收到Sass::SyntaxError所说的Undefined variable: "$darkRed".我在做什么错了?

Using Rails 3.2 with SASS. I have a configuration partial that defines a bunch of SASS variables that I want to use throughout my scss files. Per this guide, I import configuration first, then bonus. However, I keep getting a Sass::SyntaxError saying Undefined variable: "$darkRed" in bonus.css.scss. What am I doing wrong?

application.css.scss

application.css.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, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, 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 top of the
 * compiled file, but it's generally better to create a new file per style scope.
*/

@import "configuration";
@import "bootstrap";
@import "bonus";

_configuration.css.scss

_configuration.css.scss

//colors
$darkRed: #B94A48;
$controlColor: #777;

bonus.css.scss

bonus.css.scss

div.give-inline-help .help-inline
  {
  color: $darkRed;
  font-size: 15px;
  font-family: MuseoSans-300;
  padding-left: 0px;
}

推荐答案

您在application.css.scss中导入名称错误的scss文件:

You import scss file with wrong name in application.css.scss:

替换:@import "configuration";

具有:@import "_configuration";

或将您的_configuration.css.scss文件重命名为configuration.css.scss

or rename your _configuration.css.scss file to configuration.css.scss

这篇关于Sass :: SyntaxError未定义变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆