Format SVG after generation to remove empty spaces and fix indentations

This commit is contained in:
lowlighter
2021-03-30 13:24:16 +02:00
parent 190dd397de
commit 576d7aa337
3 changed files with 38 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
import ejs from "ejs"
import util from "util"
import SVGO from "svgo"
import xmlformat from "xml-formatter"
//Setup
export default async function metrics({login, q}, {graphql, rest, plugins, conf, die = false, verify = false, convert = null}, {Plugins, Templates}) {
@@ -71,6 +72,7 @@
if (q["config.gemoji"])
rendered = await imports.svg.gemojis(rendered, {rest})
//Optimize rendering
rendered = xmlformat(rendered, {lineSeparator:"\n"})
if ((conf.settings?.optimize)&&(!q.raw)) {
console.debug(`metrics/compute/${login} > optimize`)
if (experimental.has("--optimize")) {