Galerie und tage
This commit is contained in:
159
node_modules/gulp-imagemin/readme.md
generated
vendored
159
node_modules/gulp-imagemin/readme.md
generated
vendored
@@ -1,8 +1,8 @@
|
||||
# gulp-imagemin [](https://travis-ci.com/sindresorhus/gulp-imagemin) [](https://github.com/xojs/xo)
|
||||
# gulp-imagemin [](https://travis-ci.org/sindresorhus/gulp-imagemin)
|
||||
|
||||
> Minify PNG, JPEG, GIF and SVG images with [`imagemin`](https://github.com/imagemin/imagemin)
|
||||
> Minify PNG, JPEG, GIF and SVG images with [imagemin](https://github.com/kevva/imagemin)
|
||||
|
||||
*Issues with the output should be reported on the [`imagemin` issue tracker](https://github.com/imagemin/imagemin/issues).*
|
||||
*Issues with the output should be reported on the imagemin [issue tracker](https://github.com/kevva/imagemin/issues).*
|
||||
|
||||
|
||||
## Install
|
||||
@@ -14,70 +14,20 @@ $ npm install --save-dev gulp-imagemin
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic
|
||||
|
||||
```js
|
||||
const gulp = require('gulp');
|
||||
const imagemin = require('gulp-imagemin');
|
||||
const pngquant = require('imagemin-pngquant');
|
||||
|
||||
exports.default = () => (
|
||||
gulp.src('src/images/*')
|
||||
.pipe(imagemin())
|
||||
.pipe(gulp.dest('dist/images'))
|
||||
);
|
||||
```
|
||||
|
||||
### Custom plugin options
|
||||
|
||||
```js
|
||||
// …
|
||||
.pipe(imagemin([
|
||||
imagemin.gifsicle({interlaced: true}),
|
||||
imagemin.jpegtran({progressive: true}),
|
||||
imagemin.optipng({optimizationLevel: 5}),
|
||||
imagemin.svgo({
|
||||
plugins: [
|
||||
{removeViewBox: true},
|
||||
{cleanupIDs: false}
|
||||
]
|
||||
})
|
||||
]))
|
||||
// …
|
||||
```
|
||||
|
||||
Note that you may come across an older, implicit syntax. In versions < 3, the same was written like this:
|
||||
|
||||
```js
|
||||
// …
|
||||
.pipe(imagemin({
|
||||
interlaced: true,
|
||||
progressive: true,
|
||||
optimizationLevel: 5,
|
||||
svgoPlugins: [
|
||||
{
|
||||
removeViewBox: true
|
||||
}
|
||||
]
|
||||
}))
|
||||
// …
|
||||
```
|
||||
|
||||
### Custom plugin options and custom `gulp-imagemin` options
|
||||
|
||||
```js
|
||||
// …
|
||||
.pipe(imagemin([
|
||||
imagemin.svgo({
|
||||
plugins: [
|
||||
{
|
||||
removeViewBox: true
|
||||
}
|
||||
]
|
||||
})
|
||||
], {
|
||||
verbose: true
|
||||
}))
|
||||
// …
|
||||
gulp.task('default', () => {
|
||||
return gulp.src('src/images/*')
|
||||
.pipe(imagemin({
|
||||
progressive: true,
|
||||
svgoPlugins: [{removeViewBox: false}],
|
||||
use: [pngquant()]
|
||||
}))
|
||||
.pipe(gulp.dest('dist/images'));
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@@ -85,45 +35,74 @@ Note that you may come across an older, implicit syntax. In versions < 3, the sa
|
||||
|
||||
Comes bundled with the following **lossless** optimizers:
|
||||
|
||||
- [gifsicle](https://github.com/imagemin/imagemin-gifsicle) — *Compress GIF images*
|
||||
- [jpegtran](https://github.com/imagemin/imagemin-jpegtran) — *Compress JPEG images*
|
||||
- [optipng](https://github.com/imagemin/imagemin-optipng) — *Compress PNG images*
|
||||
- [svgo](https://github.com/imagemin/imagemin-svgo) — *Compress SVG images*
|
||||
- [gifsicle](https://github.com/kevva/imagemin-gifsicle) — *Compress GIF images*
|
||||
- [jpegtran](https://github.com/kevva/imagemin-jpegtran) — *Compress JPEG images*
|
||||
- [optipng](https://github.com/kevva/imagemin-optipng) — *Compress PNG images*
|
||||
- [svgo](https://github.com/kevva/imagemin-svgo) — *Compress SVG images*
|
||||
|
||||
These are bundled for convenience and most users will not need anything else.
|
||||
|
||||
### imagemin(plugins?, options?)
|
||||
### imagemin([options])
|
||||
|
||||
Unsupported files are ignored.
|
||||
|
||||
#### plugins
|
||||
|
||||
Type: `Array`<br>
|
||||
Default: `[imagemin.gifsicle(), imagemin.jpegtran(), imagemin.optipng(), imagemin.svgo()]`
|
||||
|
||||
[Plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use. This will overwrite the default plugins. Note that the default plugins comes with good defaults and should be sufficient in most cases. See the individual plugins for supported options.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
Options are applied to the correct files.
|
||||
|
||||
##### verbose
|
||||
##### optimizationLevel *(png)*
|
||||
|
||||
Type: `boolean`<br>
|
||||
Type: `number`
|
||||
Default: `3`
|
||||
|
||||
Select an optimization level between `0` and `7`.
|
||||
|
||||
> The optimization level 0 enables a set of optimization operations that require minimal effort. There will be no changes to image attributes like bit depth or color type, and no recompression of existing IDAT datastreams. The optimization level 1 enables a single IDAT compression trial. The trial chosen is what. OptiPNG thinks it’s probably the most effective. The optimization levels 2 and higher enable multiple IDAT compression trials; the higher the level, the more trials.
|
||||
|
||||
Level and trials:
|
||||
|
||||
1. 1 trial
|
||||
2. 8 trials
|
||||
3. 16 trials
|
||||
4. 24 trials
|
||||
5. 48 trials
|
||||
6. 120 trials
|
||||
7. 240 trials
|
||||
|
||||
##### progressive *(jpg)*
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Enabling this will log info on every image passed to `gulp-imagemin`:
|
||||
Lossless conversion to progressive.
|
||||
|
||||
```
|
||||
gulp-imagemin: ✔ image1.png (already optimized)
|
||||
gulp-imagemin: ✔ image2.png (saved 91 B - 0.4%)
|
||||
```
|
||||
##### interlaced *(gif)*
|
||||
|
||||
##### silent
|
||||
|
||||
Type: `boolean`<br>
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Don't log the number of images that have been minified.
|
||||
Interlace gif for progressive rendering.
|
||||
|
||||
You can also enable this from the command-line with the `--silent` flag if the option is not already specified.
|
||||
##### multipass *(svg)*
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Optimize svg multiple times until it's fully optimized.
|
||||
|
||||
##### svgoPlugins *(svg)*
|
||||
|
||||
Type: `array`
|
||||
Default: `[]`
|
||||
|
||||
Customize which SVGO plugins to use. [More here](https://github.com/sindresorhus/grunt-svgmin#available-optionsplugins).
|
||||
|
||||
##### use
|
||||
|
||||
Type: `array`
|
||||
Default: `null`
|
||||
|
||||
Additional [plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use with imagemin.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
|
||||
Reference in New Issue
Block a user