Bjornej / GruntLauncher

A vspackage that adds the possibility to launch Grunt tasks
MIT License
40 stars 11 forks source link

How can I run external gulp tasks? #32

Open denisz1 opened 9 years ago

denisz1 commented 9 years ago

Suppose I have a file called foo.js which contains a task called bar. This task is not defined in my main gulp file, as its a common task shared among projects. In my gulpfile.js I'll include it the normal way:

require("./path/to/other/gulp/files/foo.js");

I can run this the normal way: gulp bar.

But the extension won't recognise it, and doesn't show it.

Bjornej commented 9 years ago

Currently the plugin parses your gruntfile to identify defined grunt tasks but won't parse external files.

I can try to do the same thing I did for grunt: rely on executing directly grunt to identify defined tasks whenever the gulpfile directly references another js file.

To be precise you usually require other gulpfiles by relative path ?

denisz1 commented 9 years ago

@Bjornej Yes that seems to be how it works for me. If I use that require command as above, gulp will recognise any tasks defined in there, and I can just execute them on the command line.

Bjornej commented 9 years ago

Ok, then I'll modify the plugin to use gulp from the command line to identify the available tasks whenever a require with a relative path is found.

To do this I'll need a stronger cache on results but it shouldn't be a problem