tailwindcss/packages/@tailwindcss-upgrade/src
Robin Malfait b4a20af4d0
Improve upgrade tool to pretty print --spacing(2) (#15596)
This PR improves the upgrade tool to make sure that newly upgraded
`--spacing(2)` CSS functions is pretty printed to prevent unambiguous
looking classes (even though it compiles correctly).

If you have a class such as `m-[calc(100dvh-theme(spacing.2))]`, then we
used to convert it to `m-[calc(100dvh-calc(var(--spacing)*2))]`. But
recently we introduced the `--spacing(2)` CSS function which means that
the output now looks like this instead: `m-[calc(100dvh---spacing(2))]`.

The triple `-` is valid because the first `-` is the minus sign, the
next two `-` characters are from the function.

One solution is to introduce spaces via underscores:

```
m-[calc(100dvh_-_--spacing(2))]
```

But a simpler solution, is to wrap the `--spacing(2)` in parens to
remove the underscores and improve the readability of the `---`
characters.

```
m-[calc(100dvh-(--spacing(2)))]
```
2025-01-10 09:07:23 -05:00
..
codemods Migrate theme(…) to --theme(…), migrate calc(var(--spacing)*x) to --spacing(x) (#15579) 2025-01-09 17:17:07 +01:00
commands/help Add initial codemod tooling (#14434) 2024-09-18 16:45:43 +02:00
template Improve upgrade tool to pretty print --spacing(2) (#15596) 2025-01-10 09:07:23 -05:00
utils Improve performance of @tailwindcss/postcss and @tailwindcss/vite (#15226) 2024-11-29 10:59:29 -05:00
index.test.ts Revert new default form styles (#15100) 2024-11-22 08:55:05 -05:00
index.ts Upgrade: Error when project is already using Tailwind CSS v4 (#15015) 2024-11-19 15:53:02 +01:00
migrate-js-config.ts Convert opacity keys to percentage values (#15067) 2024-11-21 19:06:58 +01:00
migrate-postcss.ts Improve PostCSS migration (#15046) 2024-11-19 22:56:29 +01:00
migrate-prettier.ts Improve robustness when upgrading (#15038) 2024-11-19 14:29:51 +01:00
migrate.ts Add color to form reset snippet (#15064) 2024-11-21 16:14:52 +01:00
stylesheet.ts Resolve imports from CSS file (#15010) 2024-11-15 22:06:52 +01:00