1.0.0-alpha.4 • Published 6 months ago
@hidoo/gulp-task-optimize-image v1.0.0-alpha.4
@hidoo/gulp-task-optimize-image
Task that optimize image for gulp.
Installation
$ npm install --save-dev gulp@next @hidoo/gulp-task-optimize-imageUsage
import { task } from 'gulp';
import optimizeImage from '@hidoo/gulp-task-optimize-image';
task(
'image',
optimizeImage({
src: '/path/to/images/*.{jpg,jpeg,gif,png,svg,ico}',
dest: '/path/to/dest'
})
);Supported formats
- PNG
- JPEG
GIF (Partical support)
- Alpha GIF and Animated GIF are not support.
API
gifsicle
mozjpeg
optipng
svgo
optimizeImage
return image optimize task
Parameters
optionsObject option (optional, default{})options.nameString task name (use as displayName) (optional, default'optimize:image')options.srcString source pathoptions.destString destination pathoptions.evenizeBoolean apply evenize or not (optional, defaultfalse)options.placeholderBoolean generate placeholder image or not (optional, defaultfalse)options.webp(Boolean | Object) generate webp or not. use as webp options if object specified. (optional, defaultfalse)options.verboseBoolean out log or not (optional, defaultfalse)
Examples
import { task } from 'gulp';
import optimizeImage, {
gifsicle,
mozjpeg,
optipng,
svgo
} from '@hidoo/gulp-task-optimize-image';
task(
'image',
optimizeImage({
name: 'image:main',
src: '/path/to/images/*.{jpg,jpeg,gif,png,svg,ico}',
dest: '/path/to/dest',
evenize: true,
placeholder: true,
webp: {
method: 6
},
compress: {
imagemin: [
gifsicle({ interlaced: true }),
mozjpeg({ quality: 90, progressive: true }),
optipng({ optimizationLevel: 5 }),
svgo()
]
},
verbose: true
})
);Returns Function[Stream](https://nodejs.org/api/stream.html)
Test
$ pnpm testLicense
MIT
1.0.0-alpha.4
6 months ago
1.0.0-alpha.3
6 months ago
1.0.0-alpha.2
7 months ago
1.0.0-alpha.1
2 years ago
1.0.0-alpha.0
2 years ago
0.19.0
4 years ago
0.18.0
5 years ago
0.17.0
5 years ago
0.16.0
5 years ago
0.15.0
6 years ago
0.14.1
6 years ago
0.14.0
6 years ago
0.13.0
6 years ago
0.12.0
6 years ago
0.11.0
6 years ago
0.10.0
6 years ago
0.9.0
6 years ago
0.8.4
7 years ago
0.8.3
7 years ago
0.8.2
7 years ago
0.8.1
7 years ago
0.8.0
7 years ago
0.7.0
7 years ago
0.6.2
7 years ago
0.6.1
7 years ago
0.6.0
7 years ago
0.5.0
7 years ago
0.4.0
7 years ago
0.3.0
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago