Better build error handling for uglify and sass

This commit is contained in:
Tobias Reich 2014-10-09 18:57:06 +02:00
parent 8db872fa98
commit df1b47cee5

View File

@ -1,7 +1,7 @@
var gulp = require('gulp'), var gulp = require('gulp'),
plugins = require("gulp-load-plugins")(); plugins = require("gulp-load-plugins")();
paths = { var paths = {
view: [ view: [
'bower_components/jQuery/dist/jquery.min.js', 'bower_components/jQuery/dist/jquery.min.js',
'bower_components/js-md5/js/md5.min.js', 'bower_components/js-md5/js/md5.min.js',
@ -23,7 +23,14 @@ paths = {
] ]
} }
gulp.task('view', function () { var catchError = function(err) {
console.log(err.toString());
this.emit('end');
}
gulp.task('view', function() {
gulp.src(paths.view) gulp.src(paths.view)
.pipe(plugins.concat('view.js', {newLine: "\n"})) .pipe(plugins.concat('view.js', {newLine: "\n"}))
@ -32,19 +39,21 @@ gulp.task('view', function () {
}); });
gulp.task('js', function () { gulp.task('js', function() {
gulp.src(paths.js) gulp.src(paths.js)
.pipe(plugins.concat('main.js', {newLine: "\n"})) .pipe(plugins.concat('main.js', {newLine: "\n"}))
.pipe(plugins.uglify()) .pipe(plugins.uglify())
.on('error', catchError)
.pipe(gulp.dest('../assets/min/')); .pipe(gulp.dest('../assets/min/'));
}); });
gulp.task('css', function () { gulp.task('css', function() {
gulp.src(paths.css) gulp.src(paths.css)
.pipe(plugins.sass()) .pipe(plugins.sass())
.on('error', catchError)
.pipe(plugins.concat('main.css', {newLine: "\n"})) .pipe(plugins.concat('main.css', {newLine: "\n"}))
.pipe(plugins.autoprefixer('last 4 versions', '> 5%')) .pipe(plugins.autoprefixer('last 4 versions', '> 5%'))
.pipe(plugins.minifyCss()) .pipe(plugins.minifyCss())