Skip to content

Instantly share code, notes, and snippets.

@adritek
Last active September 28, 2017 23:48
Show Gist options
  • Save adritek/ac20d3e0955f28e17a5b303e707981f3 to your computer and use it in GitHub Desktop.
Save adritek/ac20d3e0955f28e17a5b303e707981f3 to your computer and use it in GitHub Desktop.
Gulp SASS compiler that watches (and waits)...
/*////////////////////////////////////////////////
// SASS compiler that watches... and waits... //
////////////////////////////////////////////////*/
var gulp = require("gulp");
var sass = require("gulp-sass");
var input = "./scss/**/*.scss";
var output = "./css/";
var sassOptions = {
errorToConsole: true,
outputStyle: 'expanded'
}
// Commands
gulp.task('default', ['sass', 'watch']);
// Tasks
gulp.task('sass', function() {
return gulp
.src(input)
.pipe(sass(sassOptions).on('error', sass.logError))
.pipe(gulp.dest(output));
});
gulp.task('watch', function(){
return gulp
.watch(input, ['sass'])
.on('change', function(event){
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment