tailwindcss/packages
Robin Malfait e578238da5
Migrate supports theme keys (#18817)
This PR is a follow up of #18815 and #18816, but this time let's migrate
the `supports` theme keys.

Let's imagine you have the following Tailwind CSS v3 configuration:
```ts
export default {
  content: ['./src/**/*.html'],
  theme: {
    extend: {
      supports: {
        // Automatically handled by bare values (using CSS variable as the value)
        foo: 'foo: var(--foo)', // parentheses are optional
        bar: '(bar: var(--bar))',

        // Not automatically handled because names differ
        baz: 'qux: var(--foo)',
   //   ^^^   ^^^       ← different names

        // Custom
        grid: 'display: grid',
      },
    },
  },
}
```

Then we would generate the following Tailwind CSS v4 CSS:

```css
@custom-variant supports-baz {
  @supports (qux: var(--foo)) {
    @slot;
  }
}
@custom-variant supports-grid {
  @supports (display: grid) {
    @slot;
  }
}
```

Notice how we didn't generate a custom variant for `data-foo` or
`data-bar` because those are automatically handled by bare values.

I also went with the longer form of `@custom-variant`, we could use the
single selector approach, but that felt less clear to me.

```css
@custom-variant supports-baz (@supports (qux: var(--foo)));
@custom-variant supports-grid (@supports (display: grid));
```

---------

Co-authored-by: Jordan Pittman <thecrypticace@gmail.com>
2025-08-28 14:50:48 +00:00
..
@tailwindcss-browser Drop warning from browser build (#18732) 2025-08-14 12:20:19 -04:00
@tailwindcss-cli Prepare v4.1.12 release (#18728) 2025-08-14 14:35:49 +02:00
@tailwindcss-node Prepare v4.1.12 release (#18728) 2025-08-14 14:35:49 +02:00
@tailwindcss-postcss Prepare v4.1.12 release (#18728) 2025-08-14 14:35:49 +02:00
@tailwindcss-standalone Prepare v4.1.12 release (#18728) 2025-08-14 14:35:49 +02:00
@tailwindcss-upgrade Migrate supports theme keys (#18817) 2025-08-28 14:50:48 +00:00
@tailwindcss-vite Prepare v4.1.12 release (#18728) 2025-08-14 14:35:49 +02:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Show suggestions for known matchVariant values (#18798) 2025-08-26 14:25:35 +00:00
tsconfig.base.json Improve debug logs (#15303) 2024-12-11 15:27:20 +01:00