Last active
March 30, 2016 00:28
-
-
Save M-Drummond/eab67f622f42b8bd4a66f226dfe4c6ad to your computer and use it in GitHub Desktop.
Simple Sass + Watch Gulpfile
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
var gulp = require('gulp'); | |
var sass = require('gulp-sass'); | |
var input = '*.scss'; | |
var output = ''; | |
gulp.task('sass', function () { | |
return gulp | |
// Find all `.scss` files from the `stylesheets/` folder | |
.src(input) | |
// Run Sass on those files | |
.pipe(sass()) | |
// Write the resulting CSS in the output folder | |
.pipe(gulp.dest(output)); | |
}); | |
gulp.task('watch', function() { | |
return gulp | |
// Watch the input folder for change, | |
// and run `sass` task when something happens | |
.watch(input, ['sass']) | |
// When there is a change, | |
// log a message in the console | |
.on('change', function(event) { | |
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...'); | |
}); | |
}); | |
var sassOptions = { | |
errLogToConsole: true, | |
outputStyle: 'expanded' | |
}; | |
gulp.task('sass', function () { | |
return gulp | |
.src(input) | |
.pipe(sass(sassOptions).on('error', sass.logError)) | |
.pipe(gulp.dest(output)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment