gulp: Watch is very slow to recognize file modifications

This seems to be a common problem for me, but I haven’t been able to find any issues about posted about it. Maybe I’m just doing something wrong.

When I’m developing, it frequently takes the watch task 5-15 seconds just to recognize that a file was modified. Once the task actually starts, everything execute quickly, but the problem is triggering the watch task so it notices my file modifications. This makes development much slower than manually calling a particular task. Here’s my very simple watch task:

gulp.task('less', function() {
    return gulp.src(paths.less)
        .pipe(gulpless())
        .pipe(gulp.dest('./public/css/tmp'));
});

gulp.task('watch', function() {
    gulp.watch(paths.less, ['less']);
});

Is this normal behavior? If so, is there anything I can do to speed up the file modification recognition? If not, how can I benchmark what’s taking so long?

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 16 (1 by maintainers)

Commits related to this issue

Most upvoted comments

@swvjeff,

Bit late to the party but I solved a similar issue by updating the synced folder options in my vagrantfile.

config.vm.synced_folder "dev", "/dev/vagrant",
    :nfs => true,
    :mount_options => ['actimeo=2']

By adding the 'actimeo=2' I got the updates to happen almost instantly.

Hope it helps, Rich.