Galerie und tage
This commit is contained in:
156
node_modules/imagemin/readme.md
generated
vendored
156
node_modules/imagemin/readme.md
generated
vendored
@@ -1,119 +1,141 @@
|
||||
# imagemin [](https://travis-ci.org/imagemin/imagemin)
|
||||
# imagemin [](https://travis-ci.org/imagemin/imagemin) [](https://ci.appveyor.com/project/ShinnosukeWatanabe/imagemin)
|
||||
|
||||
> Minify images seamlessly
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<sup>Gumlet is helping make open source sustainable by sponsoring Sindre Sorhus.</sup>
|
||||
<a href="https://www.gumlet.com">
|
||||
<div>
|
||||
<img src="https://sindresorhus.com/assets/thanks/gumlet-logo.svg" width="300"/>
|
||||
</div>
|
||||
<sup><b>Optimised Image Delivery made simple</b></sup>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install imagemin
|
||||
$ npm install --save imagemin
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const imagemin = require('imagemin');
|
||||
const imageminJpegtran = require('imagemin-jpegtran');
|
||||
const imageminPngquant = require('imagemin-pngquant');
|
||||
var Imagemin = require('imagemin');
|
||||
|
||||
(async () => {
|
||||
const files = await imagemin(['images/*.{jpg,png}'], {
|
||||
destination: 'build/images',
|
||||
plugins: [
|
||||
imageminJpegtran(),
|
||||
imageminPngquant({
|
||||
quality: [0.6, 0.8]
|
||||
})
|
||||
]
|
||||
new Imagemin()
|
||||
.src('images/*.{gif,jpg,png,svg}')
|
||||
.dest('build/images')
|
||||
.use(Imagemin.jpegtran({progressive: true}))
|
||||
.run(function (err, files) {
|
||||
console.log(files[0]);
|
||||
// => {path: 'build/images/foo.jpg', contents: <Buffer 89 50 4e ...>}
|
||||
});
|
||||
```
|
||||
|
||||
console.log(files);
|
||||
//=> [{data: <Buffer 89 50 4e …>, destinationPath: 'build/images/foo.jpg'}, …]
|
||||
})();
|
||||
You can use [gulp-rename](https://github.com/hparra/gulp-rename) to rename your files:
|
||||
|
||||
```js
|
||||
var Imagemin = require('imagemin');
|
||||
var rename = require('gulp-rename');
|
||||
|
||||
new Imagemin()
|
||||
.src('images/foo.png')
|
||||
.use(rename('bar.png'));
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### imagemin(input, options?)
|
||||
### new Imagemin()
|
||||
|
||||
Returns `Promise<object[]>` in the format `{data: Buffer, sourcePath: string, destinationPath: string}`.
|
||||
Creates a new `Imagemin` instance.
|
||||
|
||||
#### input
|
||||
### .src(file)
|
||||
|
||||
Type: `string[]`
|
||||
Type: `array`, `buffer` or `string`
|
||||
|
||||
File paths or [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
||||
Set the files to be optimized. Takes a buffer, glob string or an array of glob strings
|
||||
as argument.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### destination
|
||||
### .dest(folder)
|
||||
|
||||
Type: `string`
|
||||
|
||||
Set the destination folder to where your files will be written. If no destination is specified, no files will be written.
|
||||
Set the destination folder to where your files will be written. If you don't set
|
||||
any destination no files will be written.
|
||||
|
||||
##### plugins
|
||||
### .use(plugin)
|
||||
|
||||
Type: `Array`
|
||||
Type: `function`
|
||||
|
||||
[Plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use.
|
||||
Add a `plugin` to the middleware stack.
|
||||
|
||||
##### glob
|
||||
### .run(callback)
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
Type: `function`
|
||||
|
||||
Enable globbing when matching file paths.
|
||||
Optimize your files with the given settings.
|
||||
|
||||
### imagemin.buffer(buffer, options?)
|
||||
#### callback(err, files)
|
||||
|
||||
Returns `Promise<Buffer>`.
|
||||
The callback will return an array of vinyl files in `files`.
|
||||
|
||||
#### buffer
|
||||
|
||||
Type: `Buffer`
|
||||
## Plugins
|
||||
|
||||
Buffer to optimize.
|
||||
The following [plugins](https://www.npmjs.org/browse/keyword/imageminplugin) are bundled with imagemin:
|
||||
|
||||
#### options
|
||||
* [gifsicle](#gifsicleoptions) — Compress GIF images.
|
||||
* [jpegtran](#jpegtranoptions) — Compress JPG images.
|
||||
* [optipng](#optipngoptions) — Compress PNG images losslessly.
|
||||
* [svgo](#svgooptions) — Compress SVG images.
|
||||
|
||||
Type: `object`
|
||||
### .gifsicle(options)
|
||||
|
||||
##### plugins
|
||||
Compress GIF images.
|
||||
|
||||
Type: `Array`
|
||||
```js
|
||||
var Imagemin = require('imagemin');
|
||||
|
||||
[Plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use.
|
||||
new Imagemin()
|
||||
.use(Imagemin.gifsicle({interlaced: true}));
|
||||
```
|
||||
|
||||
## Hosted API
|
||||
### .jpegtran(options)
|
||||
|
||||
We also provide a hosted API for imagemin which may simplify your use case.
|
||||
Compress JPG images.
|
||||
|
||||
```js
|
||||
var Imagemin = require('imagemin');
|
||||
|
||||
new Imagemin()
|
||||
.use(Imagemin.jpegtran({progressive: true}));
|
||||
```
|
||||
|
||||
### .optipng(options)
|
||||
|
||||
Lossless compression of PNG images.
|
||||
|
||||
```js
|
||||
var Imagemin = require('imagemin');
|
||||
|
||||
new Imagemin()
|
||||
.use(Imagemin.optipng({optimizationLevel: 3}));
|
||||
```
|
||||
|
||||
### .svgo(options)
|
||||
|
||||
Compress SVG images.
|
||||
|
||||
```js
|
||||
var Imagemin = require('imagemin');
|
||||
|
||||
new Imagemin()
|
||||
.use(Imagemin.svgo());
|
||||
```
|
||||
|
||||
<a href="https://imagemin.saasify.sh">
|
||||
<img src="https://badges.saasify.sh?text=View%20Hosted%20API" height="40"/>
|
||||
</a>
|
||||
|
||||
## Related
|
||||
|
||||
- [imagemin-cli](https://github.com/imagemin/imagemin-cli) - CLI for this module
|
||||
- [imagemin-app](https://github.com/imagemin/imagemin-app) - GUI app for this module
|
||||
- [gulp-imagemin](https://github.com/sindresorhus/gulp-imagemin) - Gulp plugin
|
||||
- [grunt-contrib-imagemin](https://github.com/gruntjs/grunt-contrib-imagemin) - Grunt plugin
|
||||
- [imagemin-app](https://github.com/imagemin/imagemin-app) - GUI app for this module.
|
||||
- [gulp-imagemin](https://github.com/sindresorhus/gulp-imagemin) - Gulp plugin.
|
||||
- [grunt-contrib-imagemin](https://github.com/gruntjs/grunt-contrib-imagemin) - Grunt plugin.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [imagemin](https://github.com/imagemin)
|
||||
|
||||
Reference in New Issue
Block a user