A
A
Alexey Bugaev2019-07-10 10:34:36
gulp.js
Alexey Bugaev, 2019-07-10 10:34:36

Gulp+browswerSync task not working why?

Knowledgeable people tell me what needs to be done to make the task work? Gulp version 4.0.2

gulp.task('script', function(){
  gulp.src('js/*.js')
  .pipe(browserSync.reload({stream: true}))
});

mistake:5d2595081bd3f542455931.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Bugaev, 2019-07-10
@aleksei13b

It turns out that it was necessary to add return

gulp.task('script', function(){
  return gulp.src('js/*.js')
  .pipe(browserSync.reload({stream: true}))
});

M
Martovitskiy, 2019-07-10
@Martovitskiy

In Gulp4, you need to signal task completion for each function.
To solve this problem, try changing your current code:

gulp.task('script', done => {
  gulp.src('js/*.js')
  .pipe(browserSync.reload({stream: true}))
  done();
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question