From d69cc1fec60c1a5eeed71b06302d7f779a07d348 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Tue, 27 Jan 2026 11:24:35 +0100 Subject: [PATCH] Migrate from Tailwind CSS v3 to v4 (#219) - Replace JS config (tailwind.config.js) with CSS-first @theme directive - Add @tailwindcss/vite plugin for improved Vite integration - Update src/index.css with v4 syntax (@import, @theme, @utility) - Convert @layer utilities to @utility syntax - Fix hardcoded scrollbar colors in command-launcher.css - Add Tailwind v4 skill document (.claude/skills/tailwind-v4.md) - Update CLAUDE.md with Tailwind v4 quick reference https://claude.ai/code/session_01T6RenqDof8br6Nt9aKcjvq Co-authored-by: Claude --- .claude/skills/tailwind-v4.md | 401 ++++++++ CLAUDE.md | 46 +- package-lock.json | 1346 +++++++++++---------------- package.json | 4 +- postcss.config.js | 7 +- src/components/command-launcher.css | 4 +- src/index.css | 503 ++++++---- tailwind.config.js | 86 -- vite.config.ts | 3 +- 9 files changed, 1328 insertions(+), 1072 deletions(-) create mode 100644 .claude/skills/tailwind-v4.md delete mode 100644 tailwind.config.js diff --git a/.claude/skills/tailwind-v4.md b/.claude/skills/tailwind-v4.md new file mode 100644 index 0000000..2d453d5 --- /dev/null +++ b/.claude/skills/tailwind-v4.md @@ -0,0 +1,401 @@ +# Skill: Tailwind CSS v4 + +This document provides guidance for writing CSS and using Tailwind in Grimoire after the v4 migration. + +## Quick Reference + +### Import Syntax +```css +/* v4 - Single import replaces @tailwind directives */ +@import "tailwindcss"; +``` + +### Defining Theme Variables +```css +@theme { + --color-brand: oklch(0.72 0.11 221.19); + --font-display: "Satoshi", sans-serif; + --animate-fade: fade 0.3s ease-out; + + @keyframes fade { + from { opacity: 0; } + to { opacity: 1; } + } +} +``` + +### Custom Utilities +```css +/* v4 - Use @utility instead of @layer utilities */ +@utility content-auto { + content-visibility: auto; +} + +/* With nested selectors */ +@utility scrollbar-hidden { + scrollbar-width: none; + -ms-overflow-style: none; + + &::-webkit-scrollbar { + display: none; + } +} +``` + +### Custom Variants +```css +/* Simple variant */ +@custom-variant theme-dark (&:where(.dark, .dark *)); + +/* Complex variant */ +@custom-variant any-hover { + @media (any-hover: hover) { + &:hover { + @slot; + } + } +} +``` + +--- + +## Grimoire Theme System + +Grimoire uses a **two-level CSS variable system** for runtime theming: + +### Level 1: Runtime Variables (set by ThemeProvider) +These are HSL values WITHOUT the `hsl()` wrapper: +```css +:root { + --background: 222.2 84% 4.9%; + --foreground: 210 40% 98%; + --primary: 210 40% 98%; + /* ... */ +} +``` + +### Level 2: Tailwind Color Mapping (in @theme) +These reference the runtime variables with `hsl()`: +```css +@theme { + --color-background: hsl(var(--background)); + --color-foreground: hsl(var(--foreground)); + --color-primary: hsl(var(--primary)); +} +``` + +### Using Colors in Components + +**In Tailwind classes:** +```tsx +
+