Keyboard

Shortcuts

Command palette
K
Home
gh
About
ga
Projects
gp
Expertise
gx
Journal
gj
Contact
gc
Copy email
e
Call
c
Toggle theme
t
Show this help
?

↑↓ to navigate · Enter to open · Esc to close

Craft

Tailwind v4 CSS-first: what I broke, then fixed

TL;DR CSS-first means less `tailwind.config.js`, more discipline in `app.css`. Broken `@apply` fails loudly.

18 Feb 2025 · Albert Nicolas

  • tailwind
  • vite
  • css
  • frontend
Tailwind v4 CSS-first: what I broke, then fixed

1 min read Reading 0%

Tailwind CSS v4 shipped in January 2025. On the portfolio I had a bloated tailwind.config.js (tokens, fonts, plugins). CSS-first forced a cleanup.

Before / after

Before:

// tailwind.config.js
export default {
  content: ['./resources/**/*.blade.php', './resources/js/**/*.js'],
  theme: { extend: { colors: { accent: '#2de2c5' } } },
}

After (v4 mindset):

@import "tailwindcss";

@theme {
  --color-accent: #2de2c5;
  --font-display: "Syne", ui-sans-serif, system-ui, sans-serif;
}

What actually broke for me

  • @apply on classes that no longer exist as-is
  • Custom utilities defined only in the JS config
  • Dark mode: I had wired it poorly; v4 made that obvious

Client sites

Vannalec and the portfolio share the same front philosophy (Vite + Tailwind 4). When I fix a token bug on one, I check the other. Less drift means fewer “works on my machine” moments.

← Back to journal

Contact me Call