Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 13b5028

Browse files
author
Je
committed
refactor: imporve printed html format
1 parent c5e90b1 commit 13b5028

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

html.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,11 @@ export function createHtml({
5555
}
5656

5757
function attrString(v: any): string {
58-
return Object.keys(v).map(k => ` ${k}=${JSON.stringify(String(v[k]))}`).join('')
58+
return Object.keys(v).map(k => {
59+
if (v[k] === true) {
60+
return ` ${k}`
61+
} else {
62+
return ` ${k}=${JSON.stringify(String(v[k]))}`
63+
}
64+
}).join('')
5965
}

polyfill.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export const nomoduleJS = (isDev: boolean) => {
2121
`${indent}color: "#666",`,
2222
`${indent}textAlign: "center"`,
2323
'};',
24-
`el.innerHTML = '<p><strong style="font-size:24px;font-weight:700;color:#000;">${title}</strong><br>${desc}</p>';`,
2524
`for (var key in style) {`,
2625
`${indent}el.style[key] = style[key];`,
2726
`}`,
27+
`el.innerHTML = '<p><strong style="font-size:24px;font-weight:700;color:#000;">${title}</strong><br>${desc}</p>';`,
2828
].join(eol + indent.repeat(2)) + eol + indent
2929
}

0 commit comments

Comments
 (0)