S
S
Sergey2018-04-24 22:49:32
JavaScript
Sergey, 2018-04-24 22:49:32

Build GULP scripts?

Please tell me what is wrong in the task, at the first execution, all the scripts of the norms are connected, but when watcherthe task is restarted during the work, the index.min.jsscripts are written to the file only from the file script.js, and all other scripts of the libraries are erased

gulp.task('scripts', function(){
  return multipipe(
    gulp.src([
      'src/assets/libs/jquery/dist/jquery.min.js',
      'src/assets/libs/jquery_lazyload/jquery.lazyload.js',
      'src/assets/libs/slick-carousel/slick/slick.min.js',
      'src/assets/js/script.js'
    ]),
    cached('scripts'),
    concat('index.min.js'),
    uglify(),
    gulp.dest('dist/assets/js')	,
  ).on('error', notify.onError());
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Sevirinov, 2018-04-25
@sevirinov

Try like this:

gulp.task('scripts', function() {
  return gulp.src([
    'src/assets/libs/jquery/dist/jquery.min.js',
    'src/assets/libs/jquery_lazyload/jquery.lazyload.js',
    'src/assets/libs/slick-carousel/slick/slick.min.js',
    'src/assets/js/script.js'
  ]).
  on('error', notify.onError()).
  pipe(cached('scripts')).
  pipe(concat('index.min.js')).
  pipe(uglify()).
  pipe(gulp.dest('dist/assets/js')).
  pipe(browserSync.reload({stream: true}));
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question