first commit
This commit is contained in:
62
build/node_modules/imagemin-pngquant/index.js
generated
vendored
Normal file
62
build/node_modules/imagemin-pngquant/index.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
'use strict';
|
||||
const execBuffer = require('exec-buffer');
|
||||
const isPng = require('is-png');
|
||||
const pngquant = require('pngquant-bin');
|
||||
|
||||
module.exports = opts => buf => {
|
||||
opts = Object.assign({}, opts);
|
||||
|
||||
if (!Buffer.isBuffer(buf)) {
|
||||
return Promise.reject(new TypeError('Expected a buffer'));
|
||||
}
|
||||
|
||||
if (!isPng(buf)) {
|
||||
return Promise.resolve(buf);
|
||||
}
|
||||
|
||||
const args = [
|
||||
'--output', execBuffer.output,
|
||||
execBuffer.input
|
||||
];
|
||||
|
||||
if (opts.floyd && typeof opts.floyd === 'number') {
|
||||
args.push(`--floyd=${opts.floyd}`);
|
||||
}
|
||||
|
||||
if (opts.floyd && typeof opts.floyd === 'boolean') {
|
||||
args.push('--floyd');
|
||||
}
|
||||
|
||||
if (opts.nofs) {
|
||||
args.push('--nofs');
|
||||
}
|
||||
|
||||
if (opts.posterize) {
|
||||
args.push('--posterize', opts.posterize);
|
||||
}
|
||||
|
||||
if (opts.quality) {
|
||||
args.push('--quality', opts.quality);
|
||||
}
|
||||
|
||||
if (opts.speed) {
|
||||
args.push('--speed', opts.speed);
|
||||
}
|
||||
|
||||
if (opts.verbose) {
|
||||
args.push('--verbose');
|
||||
}
|
||||
|
||||
return execBuffer({
|
||||
input: buf,
|
||||
bin: pngquant,
|
||||
args
|
||||
}).catch(err => {
|
||||
if (err.code === 99) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
err.message = err.stderr || err.message;
|
||||
throw err;
|
||||
});
|
||||
};
|
||||
21
build/node_modules/imagemin-pngquant/license
generated
vendored
Normal file
21
build/node_modules/imagemin-pngquant/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) imagemin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
85
build/node_modules/imagemin-pngquant/package.json
generated
vendored
Normal file
85
build/node_modules/imagemin-pngquant/package.json
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"_from": "imagemin-pngquant",
|
||||
"_id": "imagemin-pngquant@5.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-2KMp2lU6+iJrEc5i3r4Lfje0OeY=",
|
||||
"_location": "/imagemin-pngquant",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "imagemin-pngquant",
|
||||
"name": "imagemin-pngquant",
|
||||
"escapedName": "imagemin-pngquant",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/imagemin-pngquant/-/imagemin-pngquant-5.0.1.tgz",
|
||||
"_shasum": "d8a329da553afa226b11ce62debe0b7e37b439e6",
|
||||
"_spec": "imagemin-pngquant",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/imagemin"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/imagemin/imagemin-pngquant/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"exec-buffer": "^3.0.0",
|
||||
"is-png": "^1.0.0",
|
||||
"pngquant-bin": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "pngquant imagemin plugin",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"pify": "^3.0.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/imagemin/imagemin-pngquant#readme",
|
||||
"keywords": [
|
||||
"compress",
|
||||
"image",
|
||||
"imageminplugin",
|
||||
"img",
|
||||
"minify",
|
||||
"optimize",
|
||||
"png",
|
||||
"pngquant"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
{
|
||||
"name": "Shinnosuke Watanabe",
|
||||
"url": "github.com/shinnn"
|
||||
}
|
||||
],
|
||||
"name": "imagemin-pngquant",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/imagemin/imagemin-pngquant.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "5.0.1"
|
||||
}
|
||||
88
build/node_modules/imagemin-pngquant/readme.md
generated
vendored
Normal file
88
build/node_modules/imagemin-pngquant/readme.md
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
# imagemin-pngquant [](https://travis-ci.org/imagemin/imagemin-pngquant) [](https://ci.appveyor.com/project/kevva/imagemin-pngquant)
|
||||
|
||||
> pngquant imagemin plugin
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save imagemin-pngquant
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const imagemin = require('imagemin');
|
||||
const imageminPngquant = require('imagemin-pngquant');
|
||||
|
||||
imagemin(['images/*.png'], 'build/images', {use: [imageminPngquant()]}).then(() => {
|
||||
console.log('Images optimized');
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### imageminPngquant([options])(buffer)
|
||||
|
||||
Returns a promise for a buffer.
|
||||
|
||||
#### options
|
||||
|
||||
##### floyd
|
||||
|
||||
Type: `number` `boolean`<br>
|
||||
Default: `0.5`
|
||||
|
||||
Controls level of dithering (0 = none, 1 = full).
|
||||
|
||||
##### nofs
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Disable Floyd-Steinberg dithering.
|
||||
|
||||
##### posterize
|
||||
|
||||
Type: `number`
|
||||
|
||||
Reduce precision of the palette by number of bits. Use when the image will be
|
||||
displayed on low-depth screens (e.g. 16-bit displays or compressed textures).
|
||||
|
||||
##### quality
|
||||
|
||||
Type: `string`
|
||||
|
||||
Instructs pngquant to use the least amount of colors required to meet or exceed
|
||||
the max quality. If conversion results in quality below the min quality the
|
||||
image won't be saved.
|
||||
|
||||
Min and max are numbers in range 0 (worst) to 100 (perfect), similar to JPEG.
|
||||
|
||||
##### speed
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `3`
|
||||
|
||||
Speed/quality trade-off from `1` (brute-force) to `10` (fastest). Speed `10` has
|
||||
5% lower quality, but is 8 times faster than the default.
|
||||
|
||||
##### verbose
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Print verbose status messages.
|
||||
|
||||
#### buffer
|
||||
|
||||
Type: `Buffer`
|
||||
|
||||
Buffer to optimize.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [imagemin](https://github.com/imagemin)
|
||||
Reference in New Issue
Block a user