Atul Verma Atul Verma - 3 months ago 69
Node.js Question

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.

AKX AKX
Answer

You are requireing gulp-sass as scss, so either

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