Created
November 14, 2016 19:29
-
-
Save mkoller/45367d52c907b3c4be1ff835a4341d3f to your computer and use it in GitHub Desktop.
Gulp Sass min function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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