2021-01-11 11:08:40 +01:00
|
|
|
const plugins = [
|
2021-01-13 10:46:24 +01:00
|
|
|
{removeDimensions: true},
|
|
|
|
{removeScriptElement: true},
|
|
|
|
{removeViewBox: false},
|
|
|
|
{moveElemsAttrsToGroup: false},
|
2021-01-14 22:47:03 +01:00
|
|
|
{convertStyleToAttrs: false},
|
2021-01-13 13:32:53 +01:00
|
|
|
{convertPathData: {
|
|
|
|
lineShorthands: false,
|
|
|
|
curveSmoothShorthands: false,
|
|
|
|
forceAbsolutePath: true,
|
|
|
|
}}
|
2021-01-11 11:08:40 +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);
|
|
|
|
};
|