Skip to content

Tailwind v4 migration + CSS-output CI gate (follow-up to #73)#74

Merged
Grol-DBT merged 2 commits into
BattletechModders:mainfrom
nx-thaddeusaid:tailwind-v4-migration
May 18, 2026
Merged

Tailwind v4 migration + CSS-output CI gate (follow-up to #73)#74
Grol-DBT merged 2 commits into
BattletechModders:mainfrom
nx-thaddeusaid:tailwind-v4-migration

Conversation

@nx-thaddeusaid
Copy link
Copy Markdown
Contributor

Merge order: this PR depends on #73 (hotfix revert). Merge #73 first to restore production, then merge this one for the proper v4 upgrade.

Summary

Long-term fix for the 2026-05-17 black-map incident. PR #73 reverted Tailwind to v3 to restore production; this PR makes the codebase actually compatible with Tailwind v4 so the next dependabot bump can land safely, and adds a CI gate that would have caught the original regression.

What changed

Tailwind v4 setup

  • postcss.config.js: tailwindcss: {}'@tailwindcss/postcss': {} (v4 split its PostCSS plugin into a separate package).
  • src/index.css: @tailwind base/components/utilities;@import \"tailwindcss\"; plus @config \"../tailwind.config.js\"; so the existing JS config keeps applying.
  • package.json: tailwindcss ^3.4.12 → ^4.3.0, add @tailwindcss/postcss ^4.3.0.

Renamed-utility fixes

Tailwind v4 renames the bare scale steps. Two call sites were affected:

  • src/components/core/SideMenu.tsx: roundedrounded-sm, hover:shadowhover:shadow-sm.
  • src/components/pages/Home.tsx: roundedrounded-sm in the Button.

@material-tailwind/react removed

Used only in src/components/pages/Home.tsx (Card/CardHeader/CardBody/CardFooter/Typography/Button) and only as styled wrappers — the className strings on the JSX already do all the layout/colour work via plain Tailwind utilities and the project's custom @layer components classes. Replaced with native <div>/<p>/<button> elements.

The @material-tailwind/react@^2 line is built on Tailwind v3. The 3.0.0-beta line is 2 years stale and still ships tailwind-merge@1.x (v3 era). Removing the dep is cleaner than chasing a v4-compatible fork.

CI smoke check

.github/workflows/test.yml gets a new step after yarn test:coverage:

  1. yarn build (with VITE_BASE_URL=/).
  2. Grep dist/assets/*.css for sentinel utilities (.w-full, .h-full, .flex, .text-center) and fail the job if any are missing.

This is the gap that let #62 ship: lint, typecheck, and vitest all stayed green because none of them inspect emitted CSS. The new check is independent of any future Tailwind / PostCSS major-bump path.

Test plan

  • yarn install clean (no new peer-dep warnings)
  • yarn build emits a 13.3 kB CSS bundle in dist/assets/
  • CSS contains every sentinel utility plus custom @layer components (.border-primary, .button-primary, .text-primary, .sideMenu-header, .ff-comfortaa) with correct rule bodies
  • yarn lint, npx tsc -p tsconfig.app.json --noEmit, npx tsc -p tsconfig.vitest.json --noEmit
  • yarn test: 17 files, 155 tests, all pass
  • yarn test:coverage: 79.95% statements / 82.07% lines (well above thresholds)
  • Dev server (yarn dev) serves 200 OK
  • Visual smoke after deploy: galaxy map renders (not black)

nx-thaddeusaid and others added 2 commits May 17, 2026 20:42
Tailwind v4 was the dependabot bump that took prod down on 2026-05-17
(black map). This commit makes the project actually compatible with v4
so the next bump can land safely.

- postcss.config.js: switch to @tailwindcss/postcss (v4 split it out)
- src/index.css: replace @tailwind directives with @import "tailwindcss";
  keep tailwind.config.js via @config directive
- SideMenu.tsx, Home.tsx: rename `rounded` -> `rounded-sm` and
  `hover:shadow` -> `hover:shadow-sm` (v4 renamed default scales)
- Home.tsx: drop @material-tailwind/react entirely. It is only used to
  wrap a handful of divs/paragraphs/buttons with classes already in
  hand; the lib is 2 years stale, ships tailwind-merge@1.x (v3 era),
  and would have blocked any clean v4 upgrade.

Verified locally: yarn install + yarn build emits a 13.3 kB CSS bundle
containing all utilities (.w-full, .h-full, .flex, .rounded-sm,
hover\:shadow-sm, custom @layer components). yarn lint, yarn test
(17 files, 155 tests), and both tsc --noEmit passes are clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Regression gate for the 2026-05-17 black-map incident. When the
tailwindcss v3 -> v4 dependabot PR merged, PostCSS silently dropped
every utility from the bundle: lint, typecheck, and vitest all stayed
green because none of them inspect emitted CSS. The Konva stage
collapsed to 0x0 and prod rendered as a black page.

After yarn build, this step greps dist/assets/*.css for sentinel
utilities (.w-full, .h-full, .flex, .text-center) and fails the job
if any are missing. Cheap, deterministic, and would have caught BattletechModders#62
before it shipped.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@nx-thaddeusaid nx-thaddeusaid force-pushed the tailwind-v4-migration branch from 5e3a35f to a04d5b8 Compare May 18, 2026 03:43
@Grol-DBT Grol-DBT merged commit 1fed6ec into BattletechModders:main May 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants