Skip to content

feat(web): compile Tailwind v4 and consume the UI theme#46

Open
ByteMeBaby wants to merge 1 commit into
mainfrom
feat/web-tailwind
Open

feat(web): compile Tailwind v4 and consume the UI theme#46
ByteMeBaby wants to merge 1 commit into
mainfrom
feat/web-tailwind

Conversation

@ByteMeBaby

Copy link
Copy Markdown
Owner

Chunk 2a of the 0.4 app shell (web half): wire Tailwind v4 into the web app so the merged @forgekit/ui components render styled. Styling substrate only; the typed api() client and the /health probe are the next chunk (2b).

What this adds

  • @tailwindcss/vite in the Vite plugin chain ([tanstackStart(), tailwindcss(), viteReact()]).
  • apps/web/src/styles.css: @import "tailwindcss" then @import "@forgekit/ui/theme.css", with @source "../node_modules/@forgekit/ui/dist" so Tailwind generates the utilities used inside the compiled ui components (it does not scan node_modules by default).
  • The stylesheet is applied through a side-effect import in __root.tsx; TanStack Start injects it for SSR and hydration.
  • The home page renders a @forgekit/ui Button as the styling smoke.
  • dev now dependsOn: ["^build"] so a fresh clone builds the ui package before the watchers start (closes a vite dev / @source race where the ui dist would be absent), and the ui package gains a tsc --watch dev script to keep its dist current.
  • vite/client ambient types replace a hand-rolled declare module "*.css" shim (also gives import.meta.env typing the next chunk needs).

Verification

  • All monorepo gates pass under TURBO_FORCE=true (28/28).
  • The built CSS contains .bg-popover and .text-muted-foreground - classes used only inside ui components, not the app - which proves @source scanned the compiled package.
  • Ran the app and confirmed visually: the rendered Button computes to the exact theme tokens (background: oklch(0.205 0 0) = --primary, color: oklch(0.985 0 0) = --primary-foreground, radius from the token scale), and the body inherits --foreground.

Docs

docs/web/app-skeleton.md gains a Styling section (the plugin, the stylesheet, the @source rule, the .dark contract, and the dev-build ordering); docs/ui/component-library.md @source example is aligned to the path used here.

Next (2b)

Shared request/response types in core, the hand-written typed api() client, and the /health up/down connectivity probe.

Wire @tailwindcss/vite into the web app so @forgekit/ui components
render styled. The app stylesheet imports tailwindcss then
@forgekit/ui/theme.css and uses @source to scan the compiled UI
package, so Tailwind generates the utilities used inside components.

- styles.css is applied through a side-effect import in __root.tsx;
  TanStack Start injects it for server rendering and hydration.
- The home page renders a UI Button as the styling smoke.
- The dev task depends on ^build so a fresh clone builds UI before the
  watchers start, and the UI package gains a tsc --watch dev script to
  keep its dist current.
- vite/client ambient types replace a hand-rolled css module shim.
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.

1 participant