V
V
Vyacheslav Lebedev2016-02-15 18:42:10
gulp.js
Vyacheslav Lebedev, 2016-02-15 18:42:10

Gulp, how to start a task for rebuilding when deleting a file with watch?

Good evening!
I don’t understand why it doesn’t perform the task when it is deleted.
console.log is executed when the file is deleted, but how can the task be restarted for reassembly?

gulp.watch('./source/**/*.{styl,css}', gulp.series('style')).on('unlink', function() {
  return gulp.series('style');
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Tishakov, 2016-02-16
@slavikse

If I understand your code correctly, then you need a command gulp.start("Task name")
Something like this...

gulp.watch('./source/**/*.{styl,css}', gulp.series('style')).on('unlink', function() {
  gulp.start("rebuild");
  return gulp.series('style');
});

K
Konstantin Velichko, 2016-02-16
@Zoxon

The standard gulp.watch does not know how to watch new or deleted files. Try using gulp-watch

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question