robrich / gulp-if

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

Invalid behaviour when using inside lazypipe - Fixes #32 #35

Closed eduardolundgren closed 10 years ago

robrich commented 10 years ago

If the trueChild or falseChild is a function, you want them to get passed the vinyl-fs object and make a choice about each file as it passes through.

robrich commented 10 years ago

Actually, I think I was incorrect. gulp-if thinks trueStream and falseStream are streams, not functions. Intriguing use-case.

eduardolundgren commented 10 years ago

Accepting a function looks non-invasive way to handle that. It could be interpreted as a new use case for gulp-if to be able to accept functions, or in other words ability to dynamic create a stream, e.g:

if('*.js', function() { return trueStream; }, function() { return falseStream; })
robrich commented 10 years ago

Looking at this further, it appears the bug wasn't in gulp-if, but was actually in lazypipe. Does the solution in https://github.com/robrich/gulp-if/issues/32 work for you? If so, it seems a more discoverable way to resolve this than teaching gulp-if how to use things that aren't streams.

robrich commented 10 years ago

documented at https://github.com/robrich/gulp-if#works-great-inside-lazypipe and https://github.com/OverZealous/lazypipe/pull/9. Thanks for your work documenting this issue.