floatdrop / gulp-watch

Watch, that actually is an endless stream

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't working "gulp-watch" with "gulp-concat"

ivanprotsko opened this issue · comments

Tell me, please. Why don't work this code?

gulp.task('scripts', function() {
return gulp.src('build/js//.js')
**.pipe(watch('build/js//
.js'))**
.pipe(concat('app.js'))
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('public/js/'))
.pipe(livereload({ start: true }));
});

Don't work Watch and Concat at the same time.

If delete row ".pipe(watch('build/js//*.js'))", then Concat is working.

Do me a favor, tell me, how i can use "gulp-watch" with "gulp-concat"?

For plugins that map multiple input files to a single output file (e.g. gulp-concat) or any other plugin that works with the stream's end event, you need to use the callback mode. See the Usage section:

gulp.task('scripts', function() {
  watch('build/js/**/.js', function() {
    .pipe(concat('app.js'))
    .pipe(babel({
      presets: ['es2015']
    }))
    .pipe(gulp.dest('public/js/'))
    .pipe(livereload({ start: true }));
  });
});