N
N
Neznaykin2016-03-02 20:55:45
JavaScript
Neznaykin, 2016-03-02 20:55:45

How to use gulp-watch to track exactly which file has changed?

watch('styles/*.less', function() {
    gulp.start('style');
  });

I watch all the .less files in the 'styles/' directory.
If one changes, I run the 'style' job.
Is there any way to get the name and path of the changed file and run the job only relative to it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Simonenko, 2016-03-02
@neznaykin

https://github.com/gulpjs/gulp/blob/master/docs/API.md
gulp.watch can be assigned callback(event), through event we get the event type and file path.

I
Ilya Erokhin, 2016-03-03
@AirWorker

You are not digging there. You only want to rebuild what has really changed, right?
Everyone wants this, and it's called "incremental build". There are simple recipes, there are not so much. To get started, I recommend watching Ilya Kantor's screencast: https://learn.javascript.ru/screencast/gulp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question