No description
Find a file
Robin Malfait 9e436f7751
Try to canonicalize any arbitrary utility to a bare value (#19379)
This PR adds an improvement to our canonicalization logic when dealing
with arbitrary values. When trying to canonicalize utilities, we make
use of the intellisense suggestions list where we typically use
multiples of the spacing scale.

This means that a value like `gap-[128px]` gets properly canonicalized
to `gap-32`. However, when you try a value that we typically don't
suggest such as `gap-[116px]` then it doesn't get canonicalized at all.

This PR fixes that by trying to use the spacing scale and convert `116px
/ 4px` and try the `gap-29` utility instead.

This is done by canonicalizing the incoming arbitrary value and the
spacing multipliers such that `--spacing: 0.25rem` and `--spacing: 4px`
both work as expected.

### Test plan

1. Added some tests with a spacing scale of `0.25rem` (which is the
default)
2. Added some tests with the same spacing scale in a different unit
`4px`
3. Added some tests with a different spacing scale `1px`

Also had to update 1 test that now gets canonicalized properly, e.g.:
`w-[124px]` → `w-31`.
2025-11-26 11:07:21 +00:00
.github Bump Vitest to v4 (#19216) 2025-11-20 18:16:20 -05:00
crates Update @emnapi/core to version 1.7.1 2025-11-21 14:57:54 +00:00
integrations Fix source map generation during when watching files on the CLI (#19373) 2025-11-25 12:22:57 -05:00
packages Try to canonicalize any arbitrary utility to a bare value (#19379) 2025-11-26 11:07:21 +00:00
patches Update Lightning CSS to 1.30.2 (#19143) 2025-10-17 15:41:49 -04:00
playgrounds Update @vitejs/plugin-react 5.1.0 → 5.1.1 (patch) (#19355) 2025-11-21 09:41:12 -05:00
scripts Make TypeScript a bit more happy (#19124) 2025-10-14 19:52:46 +00:00
.gitignore Fix slow unit test (#17465) 2025-03-31 15:26:01 +02:00
.npmrc introduce v4 codebase 2024-03-05 14:29:15 +01:00
.prettierignore Hoist oxide/crates to just crates (#13333) 2024-03-23 09:00:48 -04:00
Cargo.lock Remove unused crossbeam dependency in oxide (#19256) 2025-11-04 10:37:21 -05:00
Cargo.toml Hoist oxide/crates to just crates (#13333) 2024-03-23 09:00:48 -04:00
CHANGELOG.md Try to canonicalize any arbitrary utility to a bare value (#19379) 2025-11-26 11:07:21 +00:00
LICENSE Add README, LICENSE, and CONTRIBUTING (#13088) 2024-03-05 14:45:39 -05:00
package.json Bump Vitest to v4 (#19216) 2025-11-20 18:16:20 -05:00
pnpm-lock.yaml Revert "Update globby 15.0.0 → 16.0.0 (major) (#19357)" 2025-11-25 13:13:08 -05:00
pnpm-workspace.yaml Update Lightning CSS to 1.30.2 (#19143) 2025-10-17 15:41:49 -04:00
README.md Update README.md (#18434) 2025-07-02 16:40:30 -04:00
rust-toolchain.toml Improve Oxide candidate extractor [0] (#16306) 2025-03-05 11:55:24 +01:00
turbo.json Fix segmentation fault when loading @tailwindcss/oxide in a Worker thread (#17276) 2025-03-18 16:28:20 -04:00
vitest.config.ts Bump Vitest to v4 (#19216) 2025-11-20 18:16:20 -05:00

Tailwind CSS

A utility-first CSS framework for rapidly building custom user interfaces.

Build Status Total Downloads Latest Release License


Documentation

For full documentation, visit tailwindcss.com.

Community

For help, discussion about best practices, or feature ideas:

Discuss Tailwind CSS on GitHub

Contributing

If you're interested in contributing to Tailwind CSS, please read our contributing docs before submitting a pull request.