Skip to content

Commit

Permalink
Update svgo to v2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Aug 14, 2021
1 parent d1bf430 commit 998d614
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
21 changes: 11 additions & 10 deletions lib/svg-sprite/transform/svgo.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ const pretty = require('prettysize');
* @param {Function} cb Callback
*/
module.exports = function(shape, config, spriter, cb) {
const defaultPluginsConfig = [{
name: 'preset-default',
params: {
overrides: {
removeXMLProcInst: Boolean(spriter.config.svg.xmlDeclaration),
removeDoctype: Boolean(spriter.config.svg.doctypeDeclaration)
}
}
}];

config = _.cloneDeep(config);
config.plugins = 'plugins' in config ? config.plugins : [];
config.plugins.push({
name: 'removeXMLProcInst',
active: Boolean(spriter.config.svg.xmlDeclaration)
}, {
name: 'removeDoctype',
active: Boolean(spriter.config.svg.doctypeDeclaration)
});

config.plugins = svgo.extendDefaultPlugins(config.plugins);
config.plugins = 'plugins' in config ? config.plugins : defaultPluginsConfig;

const svg = shape.getSVG(false);
const svgLength = svg.length;
Expand Down
16 changes: 9 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"mustache": "^4.2.0",
"phantomjs-prebuilt": "^2.1.16",
"prettysize": "^2.0.0",
"svgo": "^2.3.1",
"svgo": "^2.4.0",
"vinyl": "^2.2.1",
"winston": "^3.3.3",
"xmldom": "^0.6.0",
Expand Down

0 comments on commit 998d614

Please sign in to comment.