Search code examples
node.jsgulpgulp-watch

How do I only copy the files changed


gulp.task('scripts:source', function () {
        gulp.src('./src/admin/assets/scripts/**/*.js').pipe(gulp.dest(adminPath + '/assets/scripts'));
    });

and then I have a watch setup on it

gulp.watch('./src/admin/assets/scripts/**/*.js', ['scripts:source']);

This works and does it copy but it copies all of the files which is an issue since I have 100s of them and the development experience becomes a bit slow. Is there a way to only copy the files which have changed or do I have to live with this?


Solution

  • Have you looked at gulp-newer?

    A Gulp plugin for passing through only those source files that are newer than corresponding destination files.