schnee effeckt und fehler Korektur
This commit is contained in:
53
node_modules/imagemin-svgo/index.js
generated
vendored
53
node_modules/imagemin-svgo/index.js
generated
vendored
@@ -1,47 +1,18 @@
|
||||
'use strict';
|
||||
const isSvg = require('is-svg');
|
||||
const {optimize} = require('svgo');
|
||||
|
||||
var isSvg = require('is-svg');
|
||||
var SVGO = require('svgo');
|
||||
var through = require('through2');
|
||||
module.exports = options => async buffer => {
|
||||
options = {multipass: true, ...options};
|
||||
|
||||
module.exports = function (opts) {
|
||||
opts = opts || {};
|
||||
if (!isSvg(buffer)) {
|
||||
return Promise.resolve(buffer);
|
||||
}
|
||||
|
||||
return through.ctor({objectMode: true}, function (file, enc, cb) {
|
||||
if (file.isNull()) {
|
||||
cb(null, file);
|
||||
return;
|
||||
}
|
||||
if (Buffer.isBuffer(buffer)) {
|
||||
buffer = buffer.toString();
|
||||
}
|
||||
|
||||
if (file.isStream()) {
|
||||
cb(new Error('Streaming is not supported'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isSvg(file.contents)) {
|
||||
cb(null, file);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
var svgo = new SVGO(opts);
|
||||
|
||||
svgo.optimize(file.contents.toString('utf8'), function (res) {
|
||||
if (!res.data || !res.data.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
res.data = res.data.replace(/&(?!amp;)/g, '&');
|
||||
res.data = new Buffer(res.data);
|
||||
|
||||
file.contents = res.data;
|
||||
});
|
||||
} catch (err) {
|
||||
err.fileName = file.path;
|
||||
cb(err);
|
||||
return;
|
||||
}
|
||||
|
||||
cb(null, file);
|
||||
});
|
||||
const {data} = optimize(buffer, options);
|
||||
return Buffer.from(data);
|
||||
};
|
||||
|
||||
22
node_modules/imagemin-svgo/license
generated
vendored
22
node_modules/imagemin-svgo/license
generated
vendored
@@ -1,21 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Copyright (c) imagemin
|
||||
Copyright (c) Imagemin (github.com/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:
|
||||
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 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.
|
||||
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
node_modules/imagemin-svgo/package.json
generated
vendored
85
node_modules/imagemin-svgo/package.json
generated
vendored
@@ -1,53 +1,36 @@
|
||||
{
|
||||
"name": "imagemin-svgo",
|
||||
"version": "4.2.1",
|
||||
"description": "SVGO imagemin plugin",
|
||||
"license": "MIT",
|
||||
"repository": "imagemin/imagemin-svgo",
|
||||
"author": {
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
{
|
||||
"name": "Shinnosuke Watanabe",
|
||||
"url": "github.com/shinnn"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"compress",
|
||||
"gulpplugin",
|
||||
"image",
|
||||
"imageminplugin",
|
||||
"img",
|
||||
"minify",
|
||||
"optimize",
|
||||
"svg",
|
||||
"svgo"
|
||||
],
|
||||
"dependencies": {
|
||||
"is-svg": "^1.0.0",
|
||||
"svgo": "^0.6.0",
|
||||
"through2": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"vinyl": "^1.1.0",
|
||||
"xo": "*"
|
||||
}
|
||||
"name": "imagemin-svgo",
|
||||
"version": "9.0.0",
|
||||
"description": "SVGO imagemin plugin",
|
||||
"license": "MIT",
|
||||
"repository": "imagemin/imagemin-svgo",
|
||||
"funding": {
|
||||
"url": "https://github.com/sindresorhus/imagemin-svgo?sponsor=1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"compress",
|
||||
"image",
|
||||
"imageminplugin",
|
||||
"minify",
|
||||
"optimize",
|
||||
"svg",
|
||||
"svgo"
|
||||
],
|
||||
"dependencies": {
|
||||
"is-svg": "^4.2.1",
|
||||
"svgo": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.8.0",
|
||||
"xo": "^0.30.0"
|
||||
}
|
||||
}
|
||||
|
||||
54
node_modules/imagemin-svgo/readme.md
generated
vendored
54
node_modules/imagemin-svgo/readme.md
generated
vendored
@@ -1,52 +1,56 @@
|
||||
# imagemin-svgo [](https://travis-ci.org/imagemin/imagemin-svgo) [](https://ci.appveyor.com/project/ShinnosukeWatanabe/imagemin-svgo/branch/master)
|
||||
# imagemin-svgo 
|
||||
|
||||
|
||||
> [svgo](https://github.com/svg/svgo) imagemin plugin
|
||||
> [SVGO](https://github.com/svg/svgo) imagemin plugin
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save imagemin-svgo
|
||||
$ npm install imagemin-svgo
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const Imagemin = require('imagemin');
|
||||
const imagemin = require('imagemin');
|
||||
const imageminSvgo = require('imagemin-svgo');
|
||||
const {extendDefaultPlugins} = require('svgo');
|
||||
|
||||
new Imagemin()
|
||||
.src('images/*.svg')
|
||||
.dest('build/images')
|
||||
.use(imageminSvgo())
|
||||
.run();
|
||||
```
|
||||
(async () => {
|
||||
await imagemin(['images/*.svg'], {
|
||||
destination: 'build/images',
|
||||
plugins: [
|
||||
imageminSvgo({
|
||||
plugins: extendDefaultPlugins([
|
||||
{name: 'removeViewBox', active: false}
|
||||
])
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
You can also use this plugin with [gulp](http://gulpjs.com):
|
||||
|
||||
```js
|
||||
const gulp = require('gulp');
|
||||
const imageminSvgo = require('imagemin-svgo');
|
||||
|
||||
gulp.task('default', () => {
|
||||
return gulp.src('images/*.svg')
|
||||
.pipe(imageminSvgo()())
|
||||
.pipe(gulp.dest('build/images'));
|
||||
});
|
||||
console.log('Images optimized');
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### imageminSvgo(options)
|
||||
### imageminSvgo([options])(buffer)
|
||||
|
||||
Returns a `Promise<Buffer>`.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
Type: `Object`
|
||||
|
||||
Pass options to [svgo](https://github.com/svg/svgo#what-it-can-do).
|
||||
Pass options to [SVGO](https://github.com/svg/svgo#configuration).
|
||||
|
||||
#### buffer
|
||||
|
||||
Type: `Buffer`
|
||||
|
||||
Buffer to optimize.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Reference in New Issue
Block a user