robrich / gulp-if

Conditionally run a task
MIT License
655 stars 26 forks source link

gulp-if vs. conditional operator #44

Closed icylace closed 9 years ago

icylace commented 9 years ago

Are these two equivalent ?

gulp.src('*.js')
  .pipe(gulpif(foo, bar(), baz()))
gulp.src('*.js')
  .pipe(foo ? bar() : baz())

And if so, what is the advantage of using gulp-if ?

robrich commented 9 years ago

It depends on your value of foo. If it's a Boolean, no there's no difference between these two. If it's a regex matching the filename, a glob, or a function, it makes all the difference in the world.

icylace commented 9 years ago

I see, thanks !