我正在尝试使用 imagemin Gulp 优化我的图像
https://www.npmjs.com/package/gulp-image-optimization
我很难找到一个好的文档,它可以向我展示确切的参数和不同的选项。目前我的优化没有太多收获:
var imageop = require('gulp-image-optimization');
var pngquant = require('imagemin-pngquant');
var imageminJpegoptim = require('imagemin-jpegoptim');
var baseUrl = "web/assets/";
var imgSrc = baseUrl + "src/images/";
var imgDist = baseUrl + "dist/images/";
gulp.task('img', function(cb) {
gulp.src([imgSrc + '**/*.png', imgSrc + '**/*.jpg', imgSrc + '**/*.gif', imgSrc + '**/*.jpeg'])
.pipe(imageop({
optimizationLevel: 10,
progressive: true,
interlaced: true,
use: [pngquant(), imageminJpegoptim()]
}))
.pipe(gulp.dest(imgDist)).on('end', cb).on('error', cb);
});
我错过了配置中的某些内容吗?