Skip to content

chore(website deps): upgrade Tailwind CSS from v2 to v4#25362

Open
thomasqueirozb wants to merge 15 commits intomasterfrom
website-tailwind-v4
Open

chore(website deps): upgrade Tailwind CSS from v2 to v4#25362
thomasqueirozb wants to merge 15 commits intomasterfrom
website-tailwind-v4

Conversation

@thomasqueirozb
Copy link
Copy Markdown
Contributor

@thomasqueirozb thomasqueirozb commented May 4, 2026

Summary

Upgrades the vector.dev website's Tailwind CSS from v2.2.19 → v3 → v4.2.4 in two incremental steps, preserving visual parity with production throughout.

v2 → v3

  • Replaced purge with content (pointing to hugo_stats.json via a transform)
  • Removed the variants block (JIT enables all variants by default)
  • Removed separate PurgeCSS PostCSS plugin (redundant with JIT)
  • Fixed @variants hover { } directive (removed in v3)

v3 → v4

  • Replaced tailwindcss + postcss-import + autoprefixer with @tailwindcss/postcss (v4 bundles the others)
  • Deleted tailwind.config.cjs — all config now lives in assets/css/style.css via @import, @theme, @variant, @plugin, @source
  • Dynamic class detection: postcss.config.js generates .hugo-classes from hugo_stats.json at build time, capturing class names constructed at render time (e.g. text-{{ $color }})
  • Updated layouts/partials/css.html to skip toCSS for CSS files (LibSASS was following @import "tailwindcss" into the v4 package)
  • Pinned the full color palette to Tailwind v2's sRGB values (v4 defaults use OKLCH which differs visually)
  • Renamed dark:prose-darkdark:prose-invert across all templates (22 files)
  • Migrated bg-opacity-* / ring-opacity-* utilities to the v4 slash syntax (bg-black/50, ring-black/5)

Vector configuration

NA

How did you test this PR?

Ran a page comparison script against all 508 pages in the production sitemap: fetches each page from both https://vector.dev and http://localhost:1313, compares HTML class presence, verifies CSS rules exist for all classes, and resolves + compares color values from utility class definitions to catch palette mismatches. 508/508 pages pass with 0 failures; 5 expected v4 migration diffs are annotated (class renames, removed opacity utilities).

Checkout to commit 7aba2f3 and run npx tsx scripts/compare-pages.ts to replicate.

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

NA

@thomasqueirozb thomasqueirozb added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label May 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Your preview site for the vector.dev will be ready in a few minutes, please allow time for it to build.

Heres your preview link:
vector.dev preview

@thomasqueirozb thomasqueirozb changed the title chore(website): upgrade Tailwind CSS from v2 to v4 chore(website deps): upgrade Tailwind CSS from v2 to v4 May 4, 2026
@thomasqueirozb thomasqueirozb marked this pull request as ready for review May 4, 2026 23:04
@thomasqueirozb thomasqueirozb requested review from a team as code owners May 4, 2026 23:04
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b15bef39bc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@source inline("search-input search-results-list search-result code-sample-filename type block border-gray-200 border-gray-300 border-r border-t font-medium h-2 h-3 h-full inline leading-relaxed mb-1 ml-1 mr-1 p-2 p-4 pl-2 py-4 text-gray-600 text-gray-800 text-sm w-2 w-3");

/* Class-based dark mode via Alpine JS toggling .dark on <html> */
@variant dark (&:where(.dark, .dark *));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use @custom-variant to override dark mode selector

@variant applies an existing variant inside a rule block, but this statement attempts to redefine the dark variant selector; Tailwind v4 expects @custom-variant dark (...) for that. As written, dark:* utilities keep their default media-query behavior instead of being tied to the .dark class, so the site's manual theme toggle (which adds/removes .dark on <html>) will not reliably switch Tailwind dark styles unless the OS theme is also dark.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

@pront pront left a comment

Choose a reason for hiding this comment

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

Can we get someone from @vectordotdev/vector-website to review?

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

Labels

no-changelog Changes in this PR do not need user-facing explanations in the release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants