Answer the question
In order to leave comments, you need to log in
How to move two files at once in one gulp request, to different folders?
I need to move two different files to different directories in one request, tell me how to do it.
First file:
return gulp.src('app/css/libs.css') // Выбор файла для сжатия
.pipe(cssnano()) // Сжатие файла
.pipe(rename({
suffix: '.min'
}))// Переименование файла с добавлением .min
.pipe(gulp.dest('app/css/')),
return gulp.src('app/crm/css/libs.css') // Выбор файла для сжатия
.pipe(cssnano()) // Сжатие файла
.pipe(rename({
suffix: '.min'
}))// Переименование файла с добавлением .min
.pipe(gulp.dest('app/crm/css/'));
Answer the question
In order to leave comments, you need to log in
Create one task, call gallp twice inside it.
You can just leave it like that.
If you need to signal the end of a task, then wrap the calls in promises, and use the Promise.all method to signal the end of all (in this case, two) processes.
gulp.task('mytask', function(done){
let pipes = [];
pipes.push(new Promise((resolve, reject) => {
gulp.src(...)
.pipe()
…
.on('error', (err) => reject(err))
.on('end', () => resolve())
}));
//... повторить нужное кол-во раз
Promise.all(pipes).then((ok) => done(), (err) => done())
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question