Migrate to Tailwind CSS v4 with CSS-first configuration

- Replace tailwindcss v3 + autoprefixer with tailwindcss v4 + @tailwindcss/postcss
- Migrate tailwind.config.cjs theme to @theme block in globals.css
- Add @custom-variant dark for class-based dark mode (next-themes)
- Load typography plugin via @plugin directive, replace prose-dark with prose-invert
- Convert prose dark mode overrides from JS config to CSS (.dark .prose rules)
- Add @source directive for content submodule detection
- Replace postcss.config.cjs with postcss.config.mjs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 14:55:43 +08:00
parent 661b67cc01
commit 31b5821532
10 changed files with 684 additions and 555 deletions

View File

@@ -39,12 +39,13 @@ No test framework is configured.
## Styling
- Tailwind CSS v3 with `darkMode: 'class'` (toggled by `next-themes`)
- Tailwind CSS v4 with CSS-first configuration (no `tailwind.config.cjs`)
- Dark mode via `@custom-variant dark` in `styles/globals.css` (class-based, toggled by `next-themes`)
- Theme customization via `@theme` block in `styles/globals.css`: colors, fonts, easing, durations, shadows, keyframes, animations
- Accent color system via CSS variables set in `app/layout.tsx` from env vars: `--color-accent`, `--color-accent-soft`, `--color-accent-text-light`, `--color-accent-text-dark`
- Tailwind extends these as `accent`, `accent-soft`, `accent-textLight`, `accent-textDark` in `tailwind.config.cjs`
- Typography plugin (`@tailwindcss/typography`) with custom `prose` / `prose-dark` overrides
- Typography plugin (`@tailwindcss/typography`) loaded via `@plugin` directive; prose dark mode handled by custom `.dark .prose` CSS overrides
- English headings use Playfair Display serif (`--font-serif-eng`); body uses Inter + CJK fallback stack
- Config files use CommonJS (`.cjs`): `tailwind.config.cjs`, `postcss.config.cjs`
- PostCSS config: `postcss.config.mjs` using `@tailwindcss/postcss`
## Content Submodule