@steve
В Gulp есть несколько способов обрабатывать ошибки и делать пропуск при их возникновении:
1 2 3 4 5 6 7 8 9 10 |
const gulp = require('gulp'); const plumber = require('gulp-plumber'); const uglify = require('gulp-uglify'); gulp.task('scripts', function() { return gulp.src('js/*.js') .pipe(plumber()) .pipe(uglify()) .pipe(gulp.dest('build/js')); }); |
1 2 3 4 5 6 7 8 9 10 |
const gulp = require('gulp'); const jshint = require('gulp-jshint'); const ignore = require('gulp-ignore'); gulp.task('lint', function() { return gulp.src('js/*.js') .pipe(jshint()) .pipe(ignore.exclude('*.min.js')) .pipe(jshint.reporter('default')); }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
const gulp = require('gulp'); const jshint = require('gulp-jshint'); const uglify = require('gulp-uglify'); const ifElse = require('gulp-if-else'); gulp.task('scripts', function() { return gulp.src('js/*.js') .pipe(jshint()) .pipe(ifElse( function(file) { return file.jshint.success; }, uglify() )) .pipe(gulp.dest('build/js')); }); |
Эти методы позволяют сделать пропуск ошибок в Gulp и продолжить выполнение задачи в случае их возникновения.