Last active
September 28, 2017 23:48
-
-
Save adritek/ac20d3e0955f28e17a5b303e707981f3 to your computer and use it in GitHub Desktop.
Gulp SASS compiler that watches (and waits)...
This file contains 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
/*//////////////////////////////////////////////// | |
// 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