在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):1000ch/gulp-image开源软件地址(OpenSource Url):https://github.com/1000ch/gulp-image开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-imageOptimize PNG, JPEG, GIF, SVG images with gulp task. Install$ npm install --save-dev gulp-image External DendenciesThis package includes multiple image-related libraries so that you might be required to install several external dependencies like UsageThis is an example of import gulp from 'gulp';
import image from 'gulp-image';
gulp.task('image', () => {
gulp.src('./fixtures/*')
.pipe(image())
.pipe(gulp.dest('./dest'));
});
gulp.task('default', ['image']); You can pass an object to gulp.task('image', () => {
gulp.src('./fixtures/*')
.pipe(image({
pngquant: true,
optipng: false,
zopflipng: true,
jpegRecompress: false,
mozjpeg: true,
gifsicle: true,
svgo: true,
concurrent: 10,
quiet: true // defaults to false
}))
.pipe(gulp.dest('./dest'));
}); Set You can configure parameters applied to each optimizers such as following: gulp.task('image', () => {
gulp.src('./fixtures/*')
.pipe(image({
optipng: ['-i 1', '-strip all', '-fix', '-o7', '-force'],
pngquant: ['--speed=1', '--force', 256],
zopflipng: ['-y', '--lossy_8bit', '--lossy_transparent'],
jpegRecompress: ['--strip', '--quality', 'medium', '--min', 40, '--max', 80],
mozjpeg: ['-optimize', '-progressive'],
gifsicle: ['--optimize'],
svgo: {} // svgo accepts options defined on https://github.com/svg/svgo#configuration
}))
.pipe(gulp.dest('./dest'));
}); License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论