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.

gulp.watch stops watching files after first detection

See original GitHub issue

After the first modification to index.html, gulp.watch will stop detecting changes to the file. This issue does not exist for me on 3.9.1.


gulp.task('watch', watch);

function reloadBrowserSync(cb) {
  console.log('sssssssssssssssss');
  cb();
}

function watch(done) {
  gulp.watch(['/home/one/github/one-drop/src/index.html',
             '/home/one/github/one-drop/src/app/**/*.html'], reloadBrowserSync);
}
one@development ~/github $ node --version
v4.2.2
one@development ~/github $ npm --version
2.14.7
one@development ~/github/drop $ gulp -v
[15:11:54] CLI version 1.2.2
[15:11:54] Local version 4.0.0-alpha.2

Reference issue 1783

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

14reactions
alexisdielcommented, Jan 26, 2018

@joelwallis, i’ve tried, but found the solution in other issues.

added the done parameter and called back at the end.

gulp.task(“reload”, (done) => { browserSync.reload(); done(); }); gulp.task(“js:watch”, () => gulp.watch(“lib/**/*.js”, gulp.series(“js”, “reload”)));

4reactions
phatedcommented, Oct 25, 2016

@contract and as I noted, the other person that jumped in this thread isn’t using gulp 4…

Read more comments on GitHub >

github_iconTop Results From Across the Web

gulp-watch stops after detecting only one change in .scss ...
Every gulp task function is passed a callback as its first argument, to let you signal that the task is over. In your...
Read more >
Gulp watch not watching file changes [Solved]
My gulp-watch task has been started normally. But it seems like gulp can't detect that my files was changed.
Read more >
Tasks in Visual Studio Code
The compiler stops when Compilation complete. Watching for file changes. is printed to the console. Between those two strings problems are reported. The ......
Read more >
Using Gulp with Dart Sass
Without this, you won't be able to watch Sass files for changes - any errors would stop the watching of files. (More on...
Read more >
Watching Files
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 >

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