🎨 Format Optimization

This commit is contained in:
Tw93
2024-05-10 21:51:56 +08:00
parent eabdfc2014
commit 0e1e57ddd3
14 changed files with 92 additions and 78 deletions

12
bin/utils/combine.ts vendored
View File

@@ -4,11 +4,15 @@ export default async function combineFiles(files: string[], output: string) {
const contents = files.map(file => {
const fileContent = fs.readFileSync(file);
if (file.endsWith('.css')) {
return "window.addEventListener('DOMContentLoaded', (_event) => { const css = `" + fileContent + "`; const style = document.createElement('style'); style.innerHTML = css; document.head.appendChild(style); });";
return (
"window.addEventListener('DOMContentLoaded', (_event) => { const css = `" +
fileContent +
"`; const style = document.createElement('style'); style.innerHTML = css; document.head.appendChild(style); });"
);
}
return "window.addEventListener('DOMContentLoaded', (_event) => { " + fileContent + " });";
return "window.addEventListener('DOMContentLoaded', (_event) => { " + fileContent + ' });';
});
fs.writeFileSync(output, contents.join('\n'));
return files;
}
}