简体   繁体   中英

Undefined scss variable error

I'm trying to compile my SCSS and I'm having a pretty inexplicable gulp error.

在此处输入图片说明

So I checked my code and everything appears fine. Here's the variable in my _colors.scss file.

// dark shades
$gray1:         #3c3c3d !default;
$gray2:         #5a5a5b !default;
$gray3:         #7d7d7e !default;

And here's the line that is triggering the error in _base.scss

body{
  box-sizing: border-box;
  color: $gray1;
  font-family: $base-font;
  font-size: $font-size;
  line-height: $line-height;
  min-height: 100%;
  position: relative;
}

And here's my gulpfile css task that I ran.

gulp.task('css', function() {
    return sass('scss/**/*.scss')
        .pipe(sourcemaps.init())
        .pipe(autoprefixer())
        .pipe(concat('styles.css'))
        .on('error', sass.logError)
        .pipe(sourcemaps.write())
        .pipe(gulp.dest('./css'))
            .pipe(notify({ message: 'Wait for it....wait for it!!!' }));
});

All of my code is also in this repository in case you want to poke around (it's not much yet)

您是否在_base.scss之前包含了_collors.scss,如果不是,可能是因为它在编译时不知道该变量,因为它在以后会被导入

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM