Описание тега gulp-if

NoneGulp-if is a gulp plugin for conditional control of the flow of vinyl objects.

gulp-if is a gulp plugin for conditional control of the flow of vinyl objects. It works like a conditional stream filter in several different modes (simple condition, ternary).

Ternary filter example:

var gulpif = require('gulp-if');
var uglify = require('gulp-uglify');
var beautify = require('gulp-beautify');

var condition = function (file) {
  // TODO: add business logic 
  return true;
}

gulp.task('task', function() {
  gulp.src('./src/*.js')
    .pipe(gulpif(condition, uglify(), beautify()))
    .pipe(gulp.dest('./dist/'));
});

gulp-if npm package: https://www.npmjs.com/package/gulp-if.