Skip to content

chore(frontend): migrate to Tailwind CSS 4 - #246

Open
IanHollow wants to merge 3 commits into
Anyesh:mainfrom
IanHollow:chore/frontend-tailwind-v4
Open

IanHollow wants to merge 3 commits into
Anyesh:mainfrom
IanHollow:chore/frontend-tailwind-v4

Conversation

@IanHollow

@IanHollow IanHollow commented Oct 5, 2026 •

Copy link
Copy Markdown

Description

Move the frontend from Tailwind CSS 3 to 4.3.3. The theme, dark-mode variant, container rule, and accordion animations now live in app/globals.css. The build uses Tailwind's dedicated PostCSS plugin, and components.json points the shadcn CLI at the CSS theme instead of a JavaScript config.

Update utility names where Tailwind 4 changed their meaning, replace the old animation plugin with tw-animate-css, and update tailwind-merge so cn() handles Tailwind 4 classes. The existing colors, fonts, layout, and component variant names remain in place. This PR does not add shadcn lint rules; that can follow after the migration is reviewed.

The changes follow the Tailwind 4 upgrade guide and shadcn's Tailwind 4 guidance.

Related issue

No linked issue.

Type of change

  • Breaking change: Tailwind 4 requires modern browsers and changes how contributors define theme values
  • Documentation update
  • CI/CD or build changes

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the project's coding style
  • I added a regression test for Tailwind 4 class merging
  • Frontend tests and checks pass locally
  • I updated contributor guidance for the CSS theme
  • The migration adds no new lint errors; lint still reports its existing warnings

Testing

Test environment

  • Local development with Node 24 and npm 11
  • Docker Compose: Docker is unavailable on this host

Tests performed

  • npm ci and npm run build passed with the committed lockfile.
  • npm test passed: 195 tests in 19 files.
  • npx tsc --noEmit, npm run lint, npm run i18n:check, npm run vocab:check, and git diff --check passed. Lint reports its existing warnings.
  • npx shadcn@latest info recognizes Tailwind v4, the CSS theme, and all 21 installed UI components.
  • Compared the built /login page with upstream main in headless Chrome at desktop light, desktop dark, and narrow mobile sizes. Each screenshot was pixel-identical to the baseline. This checks the public page; authenticated screens were not visually tested.

Screenshots

No screenshots attached. The three local before-and-after comparisons had zero changed pixels.

Additional notes

Frontend development now requires Node.js 20 or newer; CI and Docker use Node.js 24. Tailwind 4 targets Safari 16.4+, Chrome 111+, and Firefox 128+. Its upgrade guide recommends staying on Tailwind 3.4 if older browsers are required.

#237 changes the frontend package manager and lockfile. If it merges first, this PR needs rebasing onto pnpm and its lockfile regenerated. A full Docker image build was not run locally.

Summary by Sourcery

Migrate the frontend styling infrastructure to Tailwind CSS 4 and update the application for its new configuration and utility conventions.

Enhancements:

  • Migrate the frontend styling system from Tailwind CSS 3 to Tailwind CSS 4 while preserving the existing visual theme and component variants.
  • Move theme tokens, dark mode, container behavior, and accordion animations into the global CSS theme.
  • Update frontend utilities and UI components for Tailwind 4 compatibility, including renamed utilities and Tailwind-aware class merging.

Build:

  • Adopt Tailwind CSS 4's dedicated PostCSS plugin and replace the JavaScript Tailwind configuration with CSS-based configuration.
  • Update frontend dependencies and lockfile for Tailwind CSS 4, tailwind-merge 3, and tw-animate-css.

Documentation:

  • Document the updated Node.js requirement and CSS-based Tailwind theme workflow for frontend contributors.

Tests:

  • Add regression coverage for merging Tailwind 4 shadow and gradient utilities.

@sourcery-ai

sourcery-ai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Migrates the frontend from Tailwind CSS 3 to 4.3.3 using a CSS-first theme and the dedicated PostCSS plugin, updates dependencies and shadcn configuration, translates affected utilities throughout the UI, and adds class-merging regression tests while preserving the existing design tokens and component variants.

Flow diagram for the Tailwind CSS 3 to 4 migration

flowchart TD
  V3["Tailwind CSS 3\nJavaScript config and plugins"] --> Migrate["Translate changed utilities\nand variants"]
  Migrate --> V4["Tailwind CSS 4.3.3\nCSS-first theme"]
  V4 --> Merge["tailwind-merge 3.7.0\ncn class merging"]
  V4 --> Animate["tw-animate-css\naccordion animations"]
  V4 --> Verify["Build, tests, typecheck\nand visual comparison"]
Loading

File-Level Changes

Change Details Files
Move Tailwind theme and framework-specific styling from JavaScript configuration into the CSS-first Tailwind 4 setup.
  • Import Tailwind 4 and tw-animate-css in the global stylesheet.
  • Define theme tokens, dark-mode behavior, container rules, and accordion keyframes with Tailwind CSS directives.
  • Preserve the existing color, typography, radius, border, and layout behavior, including the v3 border default.
  • Remove the legacy JavaScript Tailwind configuration and update contributor guidance.
frontend/app/globals.css
frontend/tailwind.config.js
CONTRIBUTING.md
Update the frontend build, CLI metadata, and dependencies for Tailwind 4.
  • Use @tailwindcss/postcss as the sole Tailwind PostCSS plugin.
  • Point shadcn configuration at the CSS theme with no JavaScript config path.
  • Upgrade tailwind-merge and Tailwind CSS, replace tailwindcss-animate with tw-animate-css, and remove autoprefixer.
  • Regenerate the npm lockfile.
frontend/postcss.config.js
frontend/components.json
frontend/package.json
frontend/package-lock.json
Migrate application and shared component utility classes to Tailwind 4 equivalents.
  • Replace renamed utilities for flex shrinking, word wrapping, outlines, gradients, shadows, blur, aspect ratios, spacing, arbitrary variants, data attributes, and CSS variable sizing.
  • Apply the changes across dashboard pages, public pages, dialogs, shared components, and shadcn UI primitives while retaining component APIs and variants.
frontend/app/dashboard/analytics/page.tsx
frontend/app/dashboard/family/feed/page.tsx
frontend/app/dashboard/learning/page.tsx
frontend/app/dashboard/outfits/[id]/page.tsx
frontend/app/dashboard/outfits/page.tsx
frontend/app/dashboard/page.tsx
frontend/app/dashboard/settings/page.tsx
frontend/app/dashboard/suggest/page.tsx
frontend/app/dashboard/wardrobe/page.tsx
frontend/app/login/page.tsx
frontend/app/page.tsx
frontend/components/analysis-queue-panel.tsx
frontend/components/color-eyedropper.tsx
frontend/components/family-ratings.tsx
frontend/components/feedback-dialog.tsx
frontend/components/header.tsx
frontend/components/item-detail-dialog.tsx
frontend/components/outfit-calendar.tsx
frontend/components/outfit-history-card.tsx
frontend/components/outfit-preview-dialog.tsx
frontend/components/outfits/outfit-card.tsx
frontend/components/pairing-card.tsx
frontend/components/shared/item-picker.tsx
frontend/components/shared/occasion-chips.tsx
frontend/components/studio/canvas-panel.tsx
frontend/components/ui/badge.tsx
frontend/components/ui/button.tsx
frontend/components/ui/card.tsx
frontend/components/ui/checkbox.tsx
frontend/components/ui/dialog.tsx
frontend/components/ui/dropdown-menu.tsx
frontend/components/ui/input.tsx
frontend/components/ui/scroll-area.tsx
frontend/components/ui/select.tsx
frontend/components/ui/slider.tsx
frontend/components/ui/switch.tsx
frontend/components/ui/tabs.tsx
frontend/components/ui/textarea.tsx
Add regression coverage for Tailwind 4 class conflict resolution.
  • Verify tailwind-merge resolves conflicting shadow and gradient utilities under Tailwind 4.
  • Retain the existing utility-merging test coverage.
frontend/tests/utils.test.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions Bot added the javascript Pull requests that update javascript code label Oct 5, 2026
sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Oct 5, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Fixed security issues:

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants