V
V
Vechkov Alexander2019-11-21 15:41:48
HTML
Vechkov Alexander, 2019-11-21 15:41:48

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/'));
});

The problem is that svg and some other formats are not optimized and as a result are not transferred to the img-optimized folder .
I want all non-optimized images to be transferred to the img-optimized folder as well . How to achieve this?
PS: please give the code that will help with this

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyach Gor, 2019-11-21
@sharnirio

Hmm, with my template I just connect all formats by type
and everything is fine and transferred and optimized, without any errors or conflicts. True, for optimization, I use other plugins.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question