Skip to content

Commit

Permalink
Format SVG after generation to remove empty spaces and fix indentations
Browse files Browse the repository at this point in the history
  • Loading branch information
lowlighter committed Mar 30, 2021
1 parent 190dd39 commit 576d7aa
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
35 changes: 34 additions & 1 deletion package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"svgo": "^2.2.0",
"twemoji-parser": "^13.0.0",
"vue": "^2.6.12",
"vue-prism-component": "^1.2.0"
"vue-prism-component": "^1.2.0",
"xml-formatter": "^2.4.0"
},
"devDependencies": {
"eslint": "^7.21.0",
Expand Down
2 changes: 2 additions & 0 deletions source/app/metrics/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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}) {
Expand Down Expand Up @@ -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")) {
Expand Down

0 comments on commit 576d7aa

Please sign in to comment.