Kathryn Crawford
Kathryn Crawford

Reputation: 611

Undefined scss variable error

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

enter image description here

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)

Upvotes: 0

Views: 112

Answers (1)

Rudi Urbanek
Rudi Urbanek

Reputation: 1953

did you include the _collors.scss before the _base.scss if not it could be that at the time it compiles it, it doesnt know the variable because it gets importet at a later point

Upvotes: 2

Related Questions