Skip to content

chore: upgrade Tailwind CSS v3 → v4#180

Merged
josecelano merged 1 commit intodevelopfrom
chore/upgrade-tailwind-v4
Feb 26, 2026
Merged

chore: upgrade Tailwind CSS v3 → v4#180
josecelano merged 1 commit intodevelopfrom
chore/upgrade-tailwind-v4

Conversation

@josecelano
Copy link
Member

Overview

Upgrades Tailwind CSS from v3 to v4 — a ground-up rewrite with a CSS-first configuration model.

Part of epic #174.

Closes #169

Package Changes

Package From To
tailwindcss ^3.4.19 ^4.2.1
prettier-plugin-tailwindcss ^0.6.10 ^0.7.2
@tailwindcss/vite ^4.2.1 (new)
autoprefixer ^10.4.24 removed (v4 handles this automatically)

The plugin packages (@tailwindcss/typography, @tailwindcss/forms, @tailwindcss/container-queries) stay at their current versions — they work with v4 via the new @plugin directive.

Migration Details

Used the official @tailwindcss/upgrade tool for the initial migration, then applied manual fixes.

src/app.css

  • @tailwind base/components/utilities@import 'tailwindcss'
  • Plugins moved from tailwind.config.ts@plugin directives
  • content array migrated to @source directive
  • Added v4 compatibility base styles for default border-color (was gray-200, now currentColor)

vite.config.ts

  • Added @tailwindcss/vite plugin (recommended for Vite projects over PostCSS)
  • Placed before sveltekit() for correct CSS processing order

postcss.config.js

  • Removed tailwindcss and autoprefixer plugins (both now handled internally by @tailwindcss/vite)

tailwind.config.ts — deleted

  • Theme had no customizations (empty extend: {})
  • Plugins are now declared via @plugin in app.css

What Was NOT Needed

  • No template changes: the codebase doesn't use any renamed utilities (shadow-smshadow-xs, outline-noneoutline-hidden, ringring-3, etc.)
  • No Sass changes: src/lib/scss/ files and <style lang="scss"> component blocks are unaffected — they use pure Sass features and no @apply

Testing Checklist

  • svelte-check: 0 errors, 0 warnings
  • npm run build: success
  • npm run lint: success (Prettier + ESLint)
  • Pre-commit hooks pass
  • Visual review in browser — all pages render correctly
  • Typography styles apply correctly (prose classes)
  • Form styles work
  • Container queries work
  • Responsive layouts work

Upgrades Tailwind CSS and related packages:

- tailwindcss: ^3.4.19 → ^4.2.1
- prettier-plugin-tailwindcss: ^0.6.10 → ^0.7.2
- @tailwindcss/vite: new (replaces PostCSS Tailwind plugin for Vite)
- autoprefixer: removed (v4 handles vendor prefixes automatically)

Migration steps performed (using official @tailwindcss/upgrade tool + manual fixes):

1. src/app.css: Migrated from @tailwind directives to CSS-first approach:
   - @tailwind base/components/utilities → @import 'tailwindcss'
   - plugins (typography, forms, container-queries) → @plugin directives
   - content array → @source directive
   - Added v4 compatibility base styles for default border-color

2. vite.config.ts: Added @tailwindcss/vite plugin (recommended over PostCSS for
   Vite projects). Placed before sveltekit() for proper CSS processing order.

3. postcss.config.js: Removed tailwindcss and autoprefixer plugins (now handled
   by @tailwindcss/vite and v4's built-in vendor prefixing).

4. tailwind.config.ts: Deleted — theme was empty (no customisations) and
   plugins are now declared via @plugin in app.css.

No template changes needed: the project has no renamed utility usages
(shadow-sm, outline-none, ring, etc.) and no @apply in Sass files.
The Sass files (src/lib/scss/) are unaffected as they don't use Tailwind
directives.

All checks pass:
- svelte-check: 0 errors, 0 warnings
- build: success
- lint: success (Prettier + ESLint)

Closes #169
Part of epic #174
@josecelano
Copy link
Member Author

ACK 738d545

@josecelano josecelano merged commit 2d99c76 into develop Feb 26, 2026
1 check passed
@josecelano josecelano deleted the chore/upgrade-tailwind-v4 branch February 26, 2026 07:42
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.

chore: upgrade Tailwind CSS v3 → v4 (breaking change)

1 participant