-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide source file path for tasks in gulp --tasks-json
output
#1180
Comments
Err... technically possible to do in undertaker (track what line of code called undertaker.add) by abusing the Error class and stackFrame overrides. @phated ? |
I don't think this is a good idea because in gulp 4, it is not recommended to break up gulpfiles in this fashion (all your functions should be exported and gulp.task should only be called in the gulpfile) |
Didn't know about this. However, it's still possible to break up gulpfiles even it is not recommended to. |
@segrey Sorry I haven't been able to write something up for this yet. Basically, the recommended pattern is going to be to export functions from your task modules, require them all in the top-level gulpfile and make all of your |
@phated Thanks for the info, I see. That would be more reusable indeed. However, if I understand correctly, nothing would prevent from tasks splitting? I mean probably there will be fewer examples of tasks split across multiple files, but who knows may be some new project template/generator will exploit such a capability. |
@segrey I started looking into this and have a WIP branch at https://github.com/gulpjs/undertaker/tree/sourceFilePath - can you take a look at the implementation and test output to see if it is what you are looking for? The main caveat I ran into was: when using an unregister (with gulp.task) function in a |
Deferring to gulp-cli 1.2.0 |
@phated BTW, this code should do the trick https://github.com/TooTallNate/node-bindings/blob/master/bindings.js#L102 |
Moved to gulpjs/gulp-cli#74 |
This information would be very useful in IDE integrations that allow to navigate from gulp tasks in a tree to their definitions in code.
If all gulp tasks are defined in a single gulpfile, there are no problems.
The problems arise where gulp tasks are spreaded among several gulpfiles. All IDEs can do in this situation is to use some sort of static analysis that determines all files required from the main gulpfile, i.e. the files where gulp tasks might be defined in. Unfortunately, static analysis fails sometimes, e.g. in case of an app generated with
yo gulp-angular
.It'd be nice to have JSON output like this:
/path/to/my.js
Thanks.
The text was updated successfully, but these errors were encountered: