Skip to content

Instantly share code, notes, and snippets.

@KOWLOR
Created May 14, 2015 14:32
Show Gist options
  • Save KOWLOR/ea896192d41a43e8599f to your computer and use it in GitHub Desktop.
Save KOWLOR/ea896192d41a43e8599f to your computer and use it in GitHub Desktop.
// Include gulp
var gulp = require('gulp');
var plumber = require('gulp-plumber');
// Include Our Plugins
var sass = require('gulp-sass'),
minifyCSS = require('gulp-minify-css'),
autoprefixer = require('gulp-autoprefixer'),
gutil = require('gulp-util');
// Error handling with plumber
var onError = function (err) {
gutil.beep();
console.log(err);
this.emit('end');
};
// Compile Our Sass
gulp.task('sass', function() {
return gulp.src('app/assets/stylesheets/src/**/*.scss')
.pipe(plumber({ errorHandler: onError }))
.pipe(sass())
.pipe(autoprefixer({
browsers: ['last 20 versions'],
cascade: false
}))
.pipe(minifyCSS({keepBreaks:false}))
.pipe(gulp.dest('app/assets/stylesheets/dist'));
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('app/assets/stylesheets/src/**/*.scss', ['sass']);
});
// Default Task
gulp.task('default', ['sass', 'watch']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment