Answer the question
In order to leave comments, you need to log in
How to transfer unoptimized images to another folder in gulp?
I use gulp and with the help of two plugins - responsive and newer I optimize the images and save them in a different folder.
I have a folder with original images ( img-origen ) and a folder with optimized images ( img-optimized ). I put all new images in img-origen and galp optimizes the images and inserts them into the img-optimized folder.
Here is the gulp code:
// Оптимизация изображений
gulp.task('img', function () {
return gulp.src('assets/img/img-origen/**/*.{png,jpg,jpeg,webp,raw}')
.pipe(newer('assets/img-optimized/'))
.pipe(responsive({
'**/*': {
width: '100%',
quality: 85
// progressive: true
}
}))
.pipe(gulp.dest('assets/img-optimized/'));
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question