question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debouncing watcher tasks with Gulp 4

See original GitHub issue

With Chokidar there’s no debounce option from what I’ve seen and instead it’s up to the user of Chokidar to pass in a debounced function. So currently I do this:

gulp.watch('**/*', _.debounce(compile, 200));

Because lodash doesn’t copy the provided function’s name, my Gulp log says, “[03:06:06] Starting ‘debounced’…” instead of “compile”. The more serious issue is that the logs never say “Finished ‘debounced’…” because the done callback that gulp.watch passed to the first invocation of the debounced function is ignored.

So what I’m looking for is an easy and reliable way to debounce gulp.watch callbacks, possibly by adding debounce support to gulp.watch itself via the options arg.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:75 (41 by maintainers)

github_iconTop GitHub Comments

3reactions
phatedcommented, Apr 28, 2016

This is complete as of https://github.com/gulpjs/gulp/commit/6c03475e1a39d18c139b4d56baa1c14a587f9f4a

Thanks to everyone that helped, tested or gave other insights.

2reactions
phatedcommented, Apr 28, 2016

@adambuczynski very soon. Need to firm up vinyl-fs first

Read more comments on GitHub >

github_iconTop Results From Across the Web

Delay gulp-watch execution - Stack Overflow
How can I make the delay to task execution so that when there is more than 1 file changes in a extreme short...
Read more >
gulp-debounced-watch - npm Package Health Analysis | Snyk
A gulp watcher with debouncing For more information about how to use this package see README. Latest version published 7 years ago. License:...
Read more >
gulp-debounced-watch - npm
A gulp watcher with debouncing. Latest version: 1.0.4, last published: 7 years ago. Start using gulp-debounced-watch in your project by running `npm i ......
Read more >
watch() - gulp.js
name type default ignoreInitial boolean true delay number 200 queue boolean true
Read more >
Gulp chokidar, Gulp-changed, Gulp 4 watch example, Gulp watch ...
gulp -debounced-watch File watcher that uses super-fast chokidar and emits vinyl ... Hi, gulp-watch crashes when deleting files and re-executing a task.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found