Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function scssLint() {
console.log('---------------SASS LINTING---------------');
return src('src/assets/scss/**/*.scss')
.pipe(sassLint({
configFile: '.scss-lint.yml'
}))
.pipe(sassLint.format())
.pipe(sassLint.failOnError());
}
gulp.task('styles', function() {
let output = debug ? 'nested' : 'compressed';
return gulp.src(assets + '/styles/scss/main.scss')
.pipe(gulpif(debug,sourcemaps.init()))
.pipe(gulpif(debug,sassLint()))
.pipe(gulpif(debug,sassLint.format()))
.pipe(gulpif(debug,sassLint.failOnError()))
.pipe(sass({includePaths: ['./node_modules/'], outputStyle: output}) .on('error', sass.logError))
.pipe(autoprefixer({ browsers: ['last 2 versions', '> 5%'] }))
.pipe(gulpif(debug,sourcemaps.write()))
.pipe(gulp.dest(assets + '/styles'))
.pipe(livereload())
.pipe(notify({ message: 'CSS complete' }));
});
gulp.task('scss:lint', () => {
return gulp.src([
configPaths.app + '**/*.scss',
configPaths.src + '**/*.scss'
])
.pipe(sasslint())
.pipe(sasslint.format())
.pipe(sasslint.failOnError())
})
gulp.task('lint', function(callback) {
return gulp.src(global.config.src + '/**/*.scss')
.pipe(sassLint({
configFile: global.path + '/.sass-lint.yml'
}))
.pipe(sassLint.format())
.pipe(sassLint.failOnError())
.on('close', callback);
});
gulp.task('lint:sass', 'Lint the SASS files.', () => {
return gulp.src([paths.allSrcSass, paths.allExampleSass])
.pipe(sassLint())
.pipe(sassLint.format())
.pipe(sassLint.failOnError());
});
return mergeStream(config.global.resources.map( function(currentResource) {
return gulp.src(config.global.src + currentResource.replace('/','') + '/css/**/*.s+(a|c)ss')
.pipe(cached('sass'))
.pipe(sassLint())
.pipe(sassLint.format())
.pipe(sassLint.failOnError());
}));
}
log({
display: 'name',
beforeEach: 'Processing: '
})
)
)
.pipe(
gulpif(!util.env.ci,
plumber({
errorHandler: notify.onError('Error: <%= error.message %>')
})
)
)
.pipe(sassLint())
.pipe(sassLint.format())
.pipe(gulpif(util.env.ci, sassLint.failOnError()));
}