From 93a636589d753f9161dc265bac63432616b24f39 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 27 Sep 2025 22:22:49 -0500 Subject: [PATCH] Fix Tailwind styles --- src/lib/build/index.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib/build/index.ts b/src/lib/build/index.ts index 956aa6a7..6817bcb2 100644 --- a/src/lib/build/index.ts +++ b/src/lib/build/index.ts @@ -73,7 +73,7 @@ async function bundle( } // Update index.html with proper script and link tags - updateIndexHtml(doc); + updateIndexHtml(doc, dist); const updatedHtml = "\n" + doc.documentElement.outerHTML; dist["index.html"] = new TextEncoder().encode(updatedHtml); @@ -156,7 +156,7 @@ export async function buildProject(options: BuildProjectOptions): Promise<{ }; } -function updateIndexHtml(doc: Document): void { +function updateIndexHtml(doc: Document, dist: Record): void { const entrypoint = doc.querySelector('script[src="/src/main.tsx"]'); if (!entrypoint) { @@ -165,8 +165,11 @@ function updateIndexHtml(doc: Document): void { entrypoint.setAttribute("src", "/main.js"); - const style = doc.createElement("link"); - style.setAttribute("rel", "stylesheet"); - style.setAttribute("href", "/main.css"); - doc.head.appendChild(style); + const css = dist["main.css"]; + if (css) { + const style = doc.createElement("style"); + style.setAttribute("type", "text/tailwindcss"); + style.textContent = new TextDecoder().decode(css); + doc.head.appendChild(style); + } } \ No newline at end of file