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()` and the initial run

See original GitHub issue

It’d be nice to allow starting an initial run for a gulp watch, e.g.:

gulp.task('watch', function() {
  return gulp.watch(['src/**/*.js', 'test/**/*.js'], {initialRun: true}, ['test.unit']);
});

Currently the only way to achieve this is to manually trigger a gulp.start, which is undocumented and thus a bit ugly.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
lholznagelcommented, Nov 4, 2015

When I understand your problem correctly, maybe this would help you:

gulp.task('watch', ['task.before.watch'], function() {
  return gulp.watch(['src/**/*.js', 'test/**/*.js'], ['test.unit']);
});

With this code, all tasks in the square brackets will start before the watch task. here is no need to use gulp.start

2reactions
phatedcommented, Nov 4, 2015

3.x is feature locked and the file watcher is completely different in 4.0 where we just wrap chokidar. We don’t want to add extra functionality on top of chokidar.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Watching Files | gulp.js
The watch() API connects globs to tasks using a file system watcher. ... If the task doesn't signal Async Completion, it will never...
Read more >
Gulp Watch only run once - Stack Overflow
I'm changing files, but watch is only executed the first time I change a file. E.g. if I start gulp watch , change...
Read more >
Gulp - Watch - Tutorialspoint
Gulp - Watch, The Watch method is used to monitor your source files. When any changes to the source file is made, the...
Read more >
Watch for Changes > Gulp! Refreshment for ... - SymfonyCasts
Gulp will run all the "dependent tasks" first, then call your function. Handy! So if we just run gulp , it runs the...
Read more >
Gulp Watch Example - Code Review Videos
This Gulp Watch example will help you! ... file) to ' watch ', and then we provide an array of tasks to run...
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