By default gulp-sass never throws a clean error exit code (1). A lot of CI systems require this exit code to fail a build. This package provides a function to do so.
Installation
npm install --save gulp-sass-error
Usage
Using es2015 modules / typescript:
import{gulpSassError}from'gulp-sass-error';
constthrowError=true;
gulp.task('sass',()=>{
returngulp.src('web/css/*.scss')
.pipe(
sass()
/** Instead of sass.logError you use gulpSassError */
.on('error',gulpSassError(throwError))
)
.pipe(postcss(config.postcss))
.pipe(gulp.dest('web/css'));
});
Using require:
const{gulpSassError}=require('gulp-sass-error');
constthrowError=true;
gulp.task('sass',()=>{
returngulp.src('web/css/*.scss')
.pipe(
sass()
/** Instead of sass.logError you use gulpSassError */