Skip to content

feat: add Tailwind CSS v4 export support#45

Merged
davideast merged 1 commit into
google-labs-code:mainfrom
sbrsubuvga:feat/tailwind-v4
May 2, 2026
Merged

feat: add Tailwind CSS v4 export support#45
davideast merged 1 commit into
google-labs-code:mainfrom
sbrsubuvga:feat/tailwind-v4

Conversation

@sbrsubuvga

@sbrsubuvga sbrsubuvga commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Fixed : #19
Adds a --format tailwind export that emits a CSS @theme { ... } block using Tailwind v4's native CSS-variable token namespaces (--color-, --font-, --text-, --leading-, --tracking-, --font-weight-, --radius-, --spacing-).

The previous v3 JSON output is preserved under the explicit --format tailwind-v3 name. Since the project is pre-1.0 (0.1.1), renaming tailwind to mean 'latest' follows the convention most tooling uses for unversioned names.

New module: packages/cli/src/linter/tailwind/v4/

  • spec.ts — types and Zod schema for v4 theme data
  • handler.ts — DesignSystemState → v4 theme data
  • serialize.ts — v4 theme data → CSS @theme string

Tests: 17 new tests (handler + serializer + fixture).

Adds a `--format tailwind` export that emits a CSS `@theme { ... }`
block using Tailwind v4's native CSS-variable token namespaces
(--color-*, --font-*, --text-*, --leading-*, --tracking-*,
--font-weight-*, --radius-*, --spacing-*).

The previous v3 JSON output is preserved under the explicit
`--format tailwind-v3` name. Since the project is pre-1.0 (0.1.1),
renaming `tailwind` to mean 'latest' follows the convention most
tooling uses for unversioned names.

New module: packages/cli/src/linter/tailwind/v4/
  - spec.ts — types and Zod schema for v4 theme data
  - handler.ts — DesignSystemState → v4 theme data
  - serialize.ts — v4 theme data → CSS @theme string

Tests: 17 new tests (handler + serializer + fixture).
@xkxx
xkxx requested a review from davideast April 28, 2026 08:13
@davideast

Copy link
Copy Markdown
Collaborator

Hey @sbrsubuvga! Thank you for this contribution.

The only change I want to make is by making the the v3 option still the default due it being a breaking change. I'll address this in a follow up though.

@davideast
davideast merged commit 2013b6e into google-labs-code:main May 2, 2026
3 checks passed
davideast added a commit that referenced this pull request May 2, 2026
…64)

Rename export format flags to avoid 'Tailwind CSS' product name confusion
and restore backwards compatibility:

- css-tailwind: Tailwind v4 CSS @theme block (new)
- json-tailwind: Tailwind v3 theme.extend JSON
- tailwind: backwards-compatible alias for json-tailwind

The output-first naming (css-*, json-*) tells the user what they'll get
before which tool it targets. Bare 'tailwind' preserves existing behavior
(JSON output), preventing a breaking change from PR #45.

Updates README.md export section and interop docs to reflect new naming.
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.

Support for Tailwindcss version 4.0 & above

2 participants