From 8aec460ee48bff1e62448b74194504663533f1f6 Mon Sep 17 00:00:00 2001 From: Lukas Date: Mon, 16 Mar 2026 12:56:15 +0100 Subject: [PATCH] Fix production class extraction by replacing template-literal classNames with cn() Tailwind v4's static extractor missed classes adjacent to ${} in template literals (e.g. `pb-8${...}`), causing missing styles in production builds. Migrated all dynamic classNames to cn() and added a check script to prevent regressions. Co-Authored-By: Claude Opus 4.6 --- apps/web/src/App.tsx | 15 ++++--- apps/web/src/components/action-bar.tsx | 21 +++++---- apps/web/src/components/condition-tags.tsx | 6 ++- apps/web/src/components/stat-block-panel.tsx | 19 +++++--- package.json | 3 +- scripts/check-cn-classnames.mjs | 47 ++++++++++++++++++++ 6 files changed, 88 insertions(+), 23 deletions(-) create mode 100644 scripts/check-cn-classnames.mjs diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index 6988b24..30fd3c1 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -30,6 +30,7 @@ import { useBulkImport } from "./hooks/use-bulk-import"; import { useEncounter } from "./hooks/use-encounter"; import { usePlayerCharacters } from "./hooks/use-player-characters"; import { useSidePanelState } from "./hooks/use-side-panel-state"; +import { cn } from "./lib/utils"; function rollDice(): number { return Math.floor(Math.random() * 20) + 1; @@ -53,12 +54,12 @@ function useActionBarAnimation(combatantCount: number) { }, [combatantCount]); const empty = combatantCount === 0; - const risingClass = rising ? " animate-rise-to-center" : ""; - const settlingClass = settling ? " animate-settle-to-bottom" : ""; + const risingClass = rising ? "animate-rise-to-center" : ""; + const settlingClass = settling ? "animate-settle-to-bottom" : ""; const exitingClass = topBarExiting - ? " absolute inset-x-0 top-0 z-10 px-4 animate-slide-up-out" + ? "absolute inset-x-0 top-0 z-10 px-4 animate-slide-up-out" : ""; - const topBarClass = settling ? " animate-slide-down-in" : exitingClass; + const topBarClass = settling ? "animate-slide-down-in" : exitingClass; const showTopBar = !empty || topBarExiting; return { @@ -200,7 +201,7 @@ export function App() {
{!!actionBarAnim.showTopBar && (