Created
September 11, 2017 21:34
-
-
Save lumpysimon/cf9887c63a345d1f933eafad45894970 to your computer and use it in GitHub Desktop.
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
var gulp = require('gulp'), | |
sass = require('gulp-sass'), | |
prefix = require('gulp-autoprefixer'), | |
sourcemaps = require('gulp-sourcemaps'), | |
livereload = require('gulp-livereload'), | |
input = { | |
'sass': [ | |
'sass/**/*.scss' | |
] | |
}, | |
output = { | |
'stylesheets': '.' | |
}, | |
sassOpts = { | |
errLogToConsole: true, | |
outputStyle: 'compressed' | |
}; | |
/* run the watch task when gulp is called without arguments */ | |
gulp.task('default', ['build-css','watch']); | |
/* compile scss files */ | |
gulp.task('build-css', function() { | |
gulp | |
.src(input.sass) | |
.pipe(sourcemaps.init()) | |
.pipe(sass(sassOpts).on('error',sass.logError)) | |
.pipe(prefix("last 2 versions")) | |
.pipe(sourcemaps.write('.')) | |
.pipe(gulp.dest(output.stylesheets)) | |
.pipe(livereload()); | |
}); | |
/* Watch these files for changes and run the task on update */ | |
gulp.task('watch', function() { | |
livereload.listen(); | |
gulp.watch(input.sass, ['build-css']); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment