Skip to content

Instantly share code, notes, and snippets.

@mkoller
Created November 14, 2016 19:29
Show Gist options
  • Save mkoller/45367d52c907b3c4be1ff835a4341d3f to your computer and use it in GitHub Desktop.
Save mkoller/45367d52c907b3c4be1ff835a4341d3f to your computer and use it in GitHub Desktop.
Gulp Sass min function
// Convert sass to css
gulp.task('sass', function(){
return gulp.src('sass/**/*.scss') // this globs all .scss files found in folder/subfolders
// Initializes sourcemaps
.pipe(sourcemaps.init()) // this produces a sourcemaps at the bottom of our .css file for browser debugging
.pipe(cssnano()) // Added in css Nano
.pipe(sass({
errLogToConsole: true // this will log sass console errors in the terminal
}))
// Writes sourcemaps into the CSS file
.pipe(sourcemaps.write())
.pipe(gulp.dest('css'))
.pipe(browserSync.reload({
stream: true // this will reload browserync everytime we modify a .scss file
}))
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment