No description
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`. |
||
|---|---|---|
| .github | ||
| crates | ||
| integrations | ||
| packages | ||
| patches | ||
| playgrounds | ||
| scripts | ||
| .gitignore | ||
| .npmrc | ||
| .prettierignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| LICENSE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| rust-toolchain.toml | ||
| turbo.json | ||
| vitest.config.ts | ||
A utility-first CSS framework for rapidly building custom user interfaces.
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.