Search code examples
node.jsgulpgulp-sass

ReferenceError: sass is not defined


When I configured gulp and running task for scss, I am getting Error saying ReferenceError: sass is not defined even I have installed gulp-scss and declared in gulp.js

var gulp = require('gulp');
var scss = require('gulp-sass');

gulp.task('sass', function () {
  return gulp.src('app/scss/mystyles.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('app/css'));
});

gulp.task('default', ['sass']);

Please suggest me what I am doing wrong.


Solution

  • You are requireing gulp-sass as scss, so either

    • change that to var sass = ..., or
    • the invocation to scss().