P
P
Pit2019-01-24 09:52:32
gulp.js
Pit, 2019-01-24 09:52:32

Imagemin does not see svg files, does not transfer them to the build folder, what should I do?

The bottom line is that gulp transfers and compresses all image files except svg, if there is svg, it does not transfer them to the build folder. I need your help.
Task code

function images(){
  return gulp.src(path.src.img)
        .pipe(cache(imagemin([
            imagemin.gifsicle({interlaced: true}),
            imagemin.jpegtran({progressive: true}),
            imageminJpegRecompress({
              loops: 5,
              min: 65,
              max: 70,
              quality:'medium'
            }),
            imagemin.svgo({
            	plugins: [
              	{cleanupIDs: false},
              {removeUselessDefs: false},
              {removeViewBox: true},
            ]
            }),
            imagemin.optipng({optimizationLevel: 3}),
            pngquant({quality: '65-70', speed: 5})
          ],{
            verbose: true
          })))
        .pipe(gulp.dest(path.build.img))
        .pipe(browserSync.reload({stream: true}));
}

function watch(){
  browserSync.init(config)
  gulp.watch(path.watch.style, styles);
  gulp.watch(path.watch.js, scripts);
  gulp.watch(path.watch.html, html);
  gulp.watch(path.watch.fonts, fonts);
  gulp.watch(path.watch.img, images);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Akulinin, 2019-01-24
@pit6262

path.src.img where is it set and what is it equal to? Maybe the image file masks are wrong

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question