mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: builder: support css
This commit is contained in:
2 files changed
+12
-6
No files matched your search
@@ -127,7 +127,13 @@ export async function buildUI() {
|
||||
...entryPoints.map((i) => `import '${relative(tmp, i).replace(/\\/g, '\\\\')}';`),
|
||||
].join('\n'));
|
||||
const pages = entry.outputFiles.filter((i) => i.path.endsWith('.js')).map((i) => i.text);
|
||||
addFile('entry.js', `window._hydroLoad=()=>{ ${pages.join('\n')} };`);
|
||||
const css = entry.outputFiles.filter((i) => i.path.endsWith('.css')).map((i) => i.text);
|
||||
addFile('entry.js', `window._hydroLoad=()=>{
|
||||
const style = document.createElement('style');
|
||||
style.textContent = ${JSON.stringify(css.join('\n'))};
|
||||
document.head.appendChild(style);
|
||||
${pages.join('\n')}
|
||||
};`);
|
||||
UiContextBase.constantVersion = hashes['entry.js'];
|
||||
for (const key in vfs) {
|
||||
if (newFiles.includes(key)) continue;
|
||||
|
||||
Reference in new issue
Block a user