first commit
This commit is contained in:
64
build/node_modules/imagemin-pngout/README.md
generated
vendored
Normal file
64
build/node_modules/imagemin-pngout/README.md
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# imagemin-pngout [](https://travis-ci.org/imagemin/imagemin-pngout) [](https://ci.appveyor.com/project/ShinnosukeWatanabe/imagemin-pngout)
|
||||
|
||||
> pngout imagemin plugin
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
$ npm install --save imagemin-pngout
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var Imagemin = require('imagemin');
|
||||
var pngout = require('imagemin-pngout');
|
||||
|
||||
var imagemin = new Imagemin()
|
||||
.src('images/*.png')
|
||||
.dest('build/images')
|
||||
.use(pngout({ strategy: 1 }));
|
||||
|
||||
imagemin.run(function (err, files) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
console.log('Files optimized successfully!');
|
||||
});
|
||||
```
|
||||
|
||||
You can also use this plugin with [gulp](http://gulpjs.com):
|
||||
|
||||
```js
|
||||
var gulp = require('gulp');
|
||||
var pngout = require('imagemin-pngout');
|
||||
|
||||
gulp.task('default', function () {
|
||||
return gulp.src('images/*.png')
|
||||
.pipe(pngout({ strategy: 1 })())
|
||||
.pipe(gulp.dest('build/images'));
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## Options
|
||||
|
||||
### strategy
|
||||
|
||||
Type: `Number`
|
||||
Default: `0`
|
||||
|
||||
Select a strategy level between `0` and `4`:
|
||||
|
||||
`0.` Extreme
|
||||
`1.` Intense
|
||||
`2.` Longest match
|
||||
`3.` Huffman only
|
||||
`4.` Uncompressed
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Kevin Mårtensson](https://github.com/kevva)
|
||||
73
build/node_modules/imagemin-pngout/index.js
generated
vendored
Normal file
73
build/node_modules/imagemin-pngout/index.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
'use strict';
|
||||
|
||||
var isPng = require('is-png');
|
||||
var pngout = require('pngout-bin').path;
|
||||
var spawn = require('child_process').spawn;
|
||||
var through = require('through2');
|
||||
|
||||
/**
|
||||
* pngout imagemin plugin
|
||||
*
|
||||
* @param {Object} opts
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function (opts) {
|
||||
opts = opts || {};
|
||||
|
||||
return through.ctor({ objectMode: true }, function (file, enc, cb) {
|
||||
if (file.isNull()) {
|
||||
cb(null, file);
|
||||
}
|
||||
|
||||
if (file.isStream()) {
|
||||
cb(new Error('Streaming is not supported'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isPng(file.contents)) {
|
||||
cb(null, file);
|
||||
return;
|
||||
}
|
||||
|
||||
var args = ['-', '-', '-y', '-force'];
|
||||
var err = '';
|
||||
var ret = [];
|
||||
var len = 0;
|
||||
|
||||
if (typeof opts.strategy === 'number') {
|
||||
args.push('-s', opts.strategy);
|
||||
}
|
||||
|
||||
var cp = spawn(pngout, args);
|
||||
|
||||
cp.stderr.on('error', function (err) {
|
||||
cb(err);
|
||||
});
|
||||
|
||||
cp.stderr.setEncoding('utf8');
|
||||
cp.stderr.on('data', function (data) {
|
||||
err += data;
|
||||
});
|
||||
|
||||
cp.stdout.on('data', function (data) {
|
||||
ret.push(data);
|
||||
len += data.length;
|
||||
});
|
||||
|
||||
cp.on('close', function (code) {
|
||||
if (code) {
|
||||
cb(new Error(err));
|
||||
return;
|
||||
}
|
||||
|
||||
if (len < file.contents.length) {
|
||||
file.contents = Buffer.concat(ret, len);
|
||||
}
|
||||
|
||||
cb(null, file);
|
||||
});
|
||||
|
||||
cp.stdin.end(file.contents);
|
||||
});
|
||||
};
|
||||
75
build/node_modules/imagemin-pngout/package.json
generated
vendored
Normal file
75
build/node_modules/imagemin-pngout/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"_from": "imagemin-pngout",
|
||||
"_id": "imagemin-pngout@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-4GjWROwtUyKHD7yF9D+9Mlb6oc8=",
|
||||
"_location": "/imagemin-pngout",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "imagemin-pngout",
|
||||
"name": "imagemin-pngout",
|
||||
"escapedName": "imagemin-pngout",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/imagemin-pngout/-/imagemin-pngout-2.0.0.tgz",
|
||||
"_shasum": "e068d644ec2d5322870fbc85f43fbd3256faa1cf",
|
||||
"_spec": "imagemin-pngout",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "https://github.com/kevva"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/imagemin/imagemin-pngout/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"is-png": "^1.0.0",
|
||||
"pngout-bin": "^2.0.0",
|
||||
"through2": "^0.6.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "pngout imagemin plugin",
|
||||
"devDependencies": {
|
||||
"ava": "^0.0.4",
|
||||
"buffer-equal": "^0.0.1",
|
||||
"vinyl-file": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/imagemin/imagemin-pngout#readme",
|
||||
"keywords": [
|
||||
"compress",
|
||||
"gulpplugin",
|
||||
"image",
|
||||
"imageminplugin",
|
||||
"img",
|
||||
"minify",
|
||||
"optimize",
|
||||
"png",
|
||||
"pngout"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "imagemin-pngout",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/imagemin/imagemin-pngout.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/test.js"
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
||||
Reference in New Issue
Block a user