A single task in gulp.watch() using gulp.task() incorrectly logs as <anonymous>
See original GitHub issueAs discussed earlier.
Using the latest version of Gulp 4:
var gulp = require('gulp');
gulp.task('css', function () {
return gulp.src('test.css');
});
gulp.task('watch', function () {
gulp.watch('test.css', gulp.task('css'))
})
Results in:
[09:45:21] Starting 'watch'...
[09:45:24] Starting '<anonymous>'...
[09:45:24] Finished '<anonymous>' after 15 ms
Whereas replacing the watch task with:
gulp.task('watch', function () {
gulp.watch('test.css', gulp.registry().get('css'))
})
Results in:
[09:52:17] Starting 'watch'...
[09:52:20] Starting 'css'...
[09:52:20] Finished 'css' after 16 ms
Issue Analytics
- State:
- Created 8 years ago
- Reactions:5
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Gulp error: The following tasks did not complete - Stack Overflow
I've seen a few example Gulp 4 examples such as this one where watchers don't seem to be accompanied by completion signals. What...
Read more >Watching Files | gulp.js
The watch() API connects globs to tasks using a file system watcher. It watches for changes to files that match the globs and...
Read more >Concatenate & Minify Javascript with Gulp, Improve Site ...
Create a gulp task and pass in the name 'scripts' and then a function. In this function, use gulp.src to grab the location...
Read more >Gulp Configuration: A Beginners Guide - WebDevStudios.com
.task() – Defines a task which executes either an anonymous or callback function. .src() – Creates a stream of files.
Read more >How do I log errors with Gulp.js? - Laracasts
I'm getting weird errors when I run my default gulp task. I tried to log the errors with plumber but I do something...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had some time to look into this and I couldn’t come up with a good reason why I wanted to return the unwrapped function. Instead,
gulp.task('taskName')
will return the wrapped function with anunwrap()
method if you need to get the original function. I have the code, just need to finish it up and push it.@jaydenseric @axvm this should be fixed by my update of undertaker in https://github.com/gulpjs/gulp/commit/d8f5c90a0622d19ef1943a2a3d02dc50e3c853e7