Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function buildSass( settings ) {
return gulp.src( settings.src )
.pipe( plugins.plumber( {
errorHandler: handleErrors
} ) )
.pipe( plugins.sourcemaps.init() )
.pipe( plugins.sass( {
includePaths: [].concat( bourbon, neat ),
errLogToConsole: true,
outputStyle: 'expanded' // Options: nested, expanded, compact, compressed
} ) )
.pipe( plugins.postcss( [
plugins.autoprefixer( settings.autoprefixer ),
mqpacker(),
] ) )
.pipe( plugins.sourcemaps.write() )
// Create *.css.
.pipe( gulp.dest( settings.dest ) ).on( 'end', function () {
plugins.util.log( plugins.util.colors.bgGreen( 'Sass has been compiled into native CSS....[buildSass()]' ) );
} )
.pipe( plugins.browserSync.stream() );
gulp.task( 'postcss', [ 'clean:styles' ], () =>
gulp.src( 'assets/sass/*.scss', paths.css )
// Deal with errors.
.pipe( plumber( {'errorHandler': handleErrors} ) )
// Wrap tasks in a sourcemap.
.pipe( sourcemaps.init() )
// Compile Sass using LibSass.
.pipe( sass( {
'includePaths': [].concat( bourbon, neat ),
'errLogToConsole': true,
'outputStyle': 'expanded' // Options: nested, expanded, compact, compressed
} ) )
// Parse with PostCSS plugins.
.pipe( postcss( [
autoprefixer( {
'browsers': [ 'last 2 version' ]
} ),
mqpacker( {
'sort': true
} )
] ) )
// Create sourcemap.
.pipe( sourcemaps.write() )