Fix branding not applying: move CSS vars out of @theme, inject after Tailwind
Tailwind v4's @theme block outputs CSS that came after the tenant theme
<style> tag, causing the defaults to win by source order. Two fixes:
- Move custom property defaults from @theme {} to :root {} so they're
at the same cascade level as tenant overrides
- Inject tenant CSS before </head> instead of after <head> so it comes
after all Tailwind output in the cascade
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
@custom-variant dark (&:where(.dark, .dark *));
|
@custom-variant dark (&:where(.dark, .dark *));
|
||||||
|
|
||||||
@theme {
|
:root {
|
||||||
--color-board-bg: #f1f2f4;
|
--color-board-bg: #f1f2f4;
|
||||||
--color-page-bg: #f9fafb;
|
--color-page-bg: #f9fafb;
|
||||||
--color-nav-bg: #0079bf;
|
--color-nav-bg: #0079bf;
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ export const handle: Handle = async ({ event, resolve }) => {
|
|||||||
|
|
||||||
const response = await resolve(event, {
|
const response = await resolve(event, {
|
||||||
transformPageChunk: tenantCSS
|
transformPageChunk: tenantCSS
|
||||||
? ({ html }) => html.replace('<head>', `<head>${tenantCSS}`)
|
? ({ html }) => html.replace('</head>', `${tenantCSS}</head>`)
|
||||||
: undefined
|
: undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user