-
-
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
Gulp 4: gulp.single or at least hide <series/parallel> with single task #1411
Comments
We aren't going to add an API just to reduce noise in this scenario and showing the series or parallel will allow for better traceability in complex compositions. |
That's a pity. Now I have to find a way to pass task functions around (maybe a function arg or import/export). Otherwise I see this type of thing:
|
I have to agree that more often than not, I find seeing the parallel and series tasks in the console annoying and detracting focus from the important information, which is the actual tasks that were run. I disagree that there should be an API for silencing them, but it would be nice if you could suppress them via a CLI parameter. Or better, enable them when you do need to debug your tasks flow. |
@adambuczynski we might be able to move them to a different log level now that we have a real logging system. |
@adambuczynski, In one case I was able to do this: // Watch.
gulp.task("watch", () => {
gulp.watch("src/**/*.ts", gulp.registry().get("build"));
}); However, this was within the context of a custom registry, so I'm not sure if it works outside of that. |
@phated that's be a good idea I think |
@adambuczynski I opened an issue on Undertaker to discuss the |
I haven't used undertaker yet to define my tasks, just using regular functions in the gulpfile with |
@adambuczynski you have to install that undertaker branch inside your gulp dependency. Gulp is just a tiny facade over undertaker (you could also do some |
Alright, did that. Seems to work great. I am no longer seeing the starting/stopping parallel and series tasks showing up, the rest seems to work as expected 👍 |
The changes for this have been released in gulp-cli v1.1.0 - you also need to update gulp dependencies on the 4.0 branch because undertaker had a release to support it. |
@glen-84 My man, that worked a treat! Before: gulp.task('watch', function () {
gulp.watch(globs.js, gulp.series('js'))
gulp.watch(globs.css, gulp.series('css'))
})
After: gulp.task('watch', function () {
gulp.watch(globs.js, gulp.registry().get('js'))
gulp.watch(globs.css, gulp.registry().get('css'))
})
|
That's not the correct way to use registries. gulp.task('watch', function () {
gulp.watch(globs.js, gulp.task('js'))
gulp.watch(globs.css, gulp.task('css'))
}) |
@phated tried that, and it would be an intuitive solution but for some reason it reports their execution as gulp.task('watch', function () {
gulp.watch(globs.js, gulp.task('js'))
gulp.watch(globs.css, gulp.task('css'))
})
A bug? |
@jaydenseric possibly. Please open a new issue and give reproduction steps (gulpfile, etc). |
I have a
default
task, and I want it to invoke thewatch
task when run.watch
is in a separate file, so I can't just reference the same function (assuming I had declared it separately).The obvious answer would be to use
gulp.series
orgulp.parallel
, but this is a bit strange, as it's only a single task, and you end up with:Would you consider one of these options?
gulp.task("default", gulp.single("watch"))
.<series/parallel>
when it's only a single task.This is actually another issue that could be solved using dependencies (
gulp.task("default", ["watch"])
-- same as Gulp 3).The text was updated successfully, but these errors were encountered: