greg 4d1d2f8c52
Some checks failed
continuous-integration/drone Build is failing
maj
2023-06-11 20:17:11 +02:00

26 lines
551 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = minifySvg;
var _svgo = require("svgo");
/** Minify SVG with SVGO */
function minifySvg(tree, options, svgoOptions = {}) {
tree.match({
tag: 'svg'
}, node => {
let svgStr = tree.render(node, {
closingSingleTag: 'slash',
quoteAllAttributes: true
});
const result = (0, _svgo.optimize)(svgStr, svgoOptions);
node.tag = false;
node.attrs = {};
node.content = result.data;
return node;
});
return tree;
}