gulp-webp
gulp-webp copied to clipboard
Too slow?
gulpconfig
const gulp = require('gulp');
const webp = require('gulp-webp');
gulp.task('img', () => {
return gulp
.src('src/*')
.pipe(webp())
.pipe(gulp.dest('dist'));
});
package.json
{
"dependencies": {
"gulp": "^4.0.2",
"gulp-webp": "^4.0.1"
}
}
src 12.9mb

dest 6.7mb (52%)

console

15 seconds? Why so slow?
In realtime:

Heh? The same but with native imagemin:

One more thing:
const gulp = require('gulp');
const webp = require('gulp-webp');
const imagemin = require('gulp-imagemin');
const imageminWebp = require('imagemin-webp');
const rename = require('gulp-rename');
gulp.task('img', () => {
return gulp
.src('src/*')
.pipe(webp())
.pipe(gulp.dest('dist'));
});
gulp.task('img-min', () => {
return gulp
.src('src/*')
.pipe(imagemin([imageminWebp()]))
.pipe(rename({ extname: '.webp' }))
.pipe(gulp.dest('dist'));
});
npx gulp img12snpx gulp img-min2.7s
Thanks for this @notiv-nt +1 indeed
Excellent contribution @notiv-nt it made a drastic difference in my optimization times:
Before

Now
