robrich / gulp-if

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

Does not work with ES2015 arrow functions #63

Closed thewebdreamer closed 6 years ago

thewebdreamer commented 8 years ago

I'm been trying to use gulp-if with arrow functions. These don't work for me as I get an error about dest.on.

Is it because arrow functions have 'this' lexically binded to them?

robrich commented 8 years ago

Yes, rebinding this with arrow functions does weird things to streams. You may be able to shim it in with bind, but are you saving characters? May be better to just use function.

thewebdreamer commented 8 years ago

I've been using arrow functions with gulp itself for my tasks and I haven't had any trouble with it. I'll use functions for now with gulp-if.

robrich commented 8 years ago

Quite interesting. Do you have a pastebin or github repo that demonstrates arrow functions working in tasks but not in gulp-if?