2021-02-22 21:40:15 +01:00
|
|
|
|
|
|
|
const plugins = [
|
2021-02-26 22:06:54 +01:00
|
|
|
{ "minifyStyles" : false },
|
|
|
|
{ "convertStyleToAttrs" : false },
|
|
|
|
{
|
|
|
|
"cleanupIDs" : {
|
|
|
|
remove: false,
|
|
|
|
minify: false,
|
|
|
|
force: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "cleanupListOfValues" : true },
|
|
|
|
{ "removeUnknownsAndDefaults" : false },
|
|
|
|
{ "removeViewBox" : false },
|
|
|
|
{ "convertShapeToPath" : false },
|
|
|
|
{ "convertEllipseToCircle" : false },
|
|
|
|
{ "moveElemsAttrsToGroup" : false },
|
2021-03-04 07:44:46 +01:00
|
|
|
{ "moveGroupAttrsToElems" : false },
|
2021-02-26 22:06:54 +01:00
|
|
|
{ "collapseGroups" : false },
|
|
|
|
{
|
|
|
|
"convertPathData" : {
|
|
|
|
lineShorthands: false,
|
|
|
|
curveSmoothShorthands: false,
|
|
|
|
forceAbsolutePath: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "convertTransform" : false },
|
|
|
|
{ "removeEmptyContainers" : false },
|
|
|
|
{ "mergePaths" : false },
|
|
|
|
{ "sortDefsChildren" : false },
|
|
|
|
{ "removeDimensions" : true },
|
2021-03-04 07:44:46 +01:00
|
|
|
{ "removeStyleElement" : false },
|
2021-02-26 22:06:54 +01:00
|
|
|
{ "removeScriptElement" : true },
|
2021-03-01 22:13:19 +01:00
|
|
|
{ "removeOffCanvasPaths" : false },
|
2021-03-04 07:44:46 +01:00
|
|
|
{ "cleanupNumericValues": true}
|
2021-02-22 21:40:15 +01:00
|
|
|
];
|
2021-01-10 19:11:22 +01:00
|
|
|
|
2021-02-26 22:06:54 +01:00
|
|
|
|
2021-01-10 19:11:22 +01:00
|
|
|
const svgc = require("./src/svgclean.js");
|
2021-01-13 11:40:33 +01:00
|
|
|
const inst = svgc.configure({plugins});
|
2021-01-10 19:11:22 +01:00
|
|
|
|
|
|
|
exports.optimize = function(data) {
|
|
|
|
return svgc.optimize(inst, data)
|
|
|
|
.then((result) => result.data);
|
|
|
|
};
|