I
I
indeveloping2020-01-10 15:06:12
gulp.js
indeveloping, 2020-01-10 15:06:12

Why are webp not converted to gulp?

Good day.
Connected plugin for converting images to webp format

const imagemin = require('gulp-imagemin')
const webpConvert = require('imagemin-webp');

exports.webp = webp = (done) => {
  gulp.src('./src/images/*.{png,jpg,jpeg}')
    .pipe(imagemin([
      webpConvert({ quality: 80 })
    ]))
    .pipe(gulp.dest('./build/assets/images'))
  done()
}

I run it in the console via gulp webp, and I get the following response:
[15:01:08] Using gulpfile ~\indevelop\frontbuild\gulpfile.js
[15:01:08] Starting 'webp'...
[15:01:08] Finished 'webp' after 12 ms
[15:01:10] gulp-imagemin: Minified 5 images (saved 2.61 MB - 59.4%)

Everything seems to be correct, but the converted webp images did not appear in the directory! I have already tried to do this in different ways, and even the plug-in gulp-webpstill does not appear. They are simply not there.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IIIu6ko, 2020-01-11
@indeveloping

Good afternoon. recently did a task for webp:

gulp.task("imgsWebp", function() {
  return gulp.src("src/blocks/**/*.{jpg,jpeg,png,gif,ico}")

    // Конвертирует изображение в webp и сжимает его.
    .pipe(webp({
      quality: 100
    }))

    // Выгрузка.
    .pipe(gulp.dest(buildImgs))

    // Browsersync.
    .pipe(gulpif(!dist, browserSync.stream())); // Если нет флага --dist.
});

webp - gulp-webp
Accordingly, as a result, a pair of images with the same name, but with different formats
5e19b2dc1d79e572945243.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question