gulp-if npm package of node.js


Overview

This gulp plugin is used when we want to run a task only iff certain condition is met.

Code


													
var gulp = require('gulp');		
var gif = require('gulp-if');
var uglify = require('gulp-uglify');
 
var value = true;
 
gulp.task('abc', function() {
  gulp.src('source/*.js')
    .pipe(gif(value, uglify()))
    .pipe(gulp.dest('destination'));
});
        
													
												

Run

  • Now run the snippet using the following command :
    													
    $gulp abc