Oliver Kucharzewski
Oliver Kucharzewski

Reputation: 2645

Using pipe during gulp watch

Currently i'm using gulp watch to automatically compile my files on update; but now i'm looking to pipe() them to multiple other folders.

For example; on use of the gulp command; these commands run:

gulp.src(['public/js/*']).pipe(gulp.dest('www'));
gulp.src(['public/css/*']).pipe(gulp.dest('www'));
gulp.src(['public/js/*']).pipe(gulp.dest('platforms/browser/www'));
gulp.src(['public/css/*']).pipe(gulp.dest('platforms/browser/www'));

How do I run a pipe() task when gulp watch notices a file change?

Upvotes: 2

Views: 186

Answers (1)

Kendrick Wong
Kendrick Wong

Reputation: 404

Try floatdrop/gulp-watch:

var watch = require('gulp-watch');
watch('public/js/*', function () {
    gulp.src('public/js/*')
        .pipe(gulp.dest('www'));
});

Upvotes: 2

Related Questions