Open notiv-nt opened 5 years ago
Heh? The same but with native imagemin
:
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 img
12snpx gulp img-min
2.7sThanks for this @notiv-nt +1 indeed
Excellent contribution @notiv-nt it made a drastic difference in my optimization times:
Before
Now
gulpconfig
package.json
src 12.9mb
dest 6.7mb (52%)
console
15 seconds? Why so slow?
In realtime: