S
S
Sergey delphinpro2015-03-19 21:45:21
gulp.js
Sergey delphinpro, 2015-03-19 21:45:21

How to force gulp to rebuild only changed files?

gulp.task('build-images', function () {
    gulp.src('src/design/images/**/*.png')
        .pipe(imagemin({
            progressive: true,
            svgoPlugins: [{removeViewBox: false}],
            use        : [pngquant()],
            interlaced : true
    	    			}))
    	    			.pipe(gulp.dest('build/design/images/'));
});

gulp.task('default', ['browser-sync'], function () {
    	gulp.watch(['src/design/images/**/*.*'], ['build-images']);
  });

Thus, when changing / adding a picture, all source files get into processing. And I would like that only a specific modified / added file is processed.
Similarly with html-files, and the rest.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
copal, 2015-03-19
@delphinpro

gulp-newer

A
AndreyOlegovich, 2019-09-18
@AndreyOlegovich

Changed is not always suitable, I use .on('change' ... ) in gulp.watch and immediately throw only the changed file into .pipe
https://urn.su/IT/gulp/watch_on_change.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question