ubdate
This commit is contained in:
18
node_modules/imagemin-svgo/index.js
generated
vendored
Normal file
18
node_modules/imagemin-svgo/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
const isSvg = require('is-svg');
|
||||
const SVGO = require('svgo');
|
||||
|
||||
module.exports = options => buffer => {
|
||||
options = Object.assign({multipass: true}, options);
|
||||
|
||||
if (!isSvg(buffer)) {
|
||||
return Promise.resolve(buffer);
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(buffer)) {
|
||||
buffer = buffer.toString();
|
||||
}
|
||||
|
||||
const svgo = new SVGO(options);
|
||||
return svgo.optimize(buffer).then(result => Buffer.from(result.data));
|
||||
};
|
||||
Reference in New Issue
Block a user