Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.