Don't add spaces to gradients and grid track names when followed by calc() (#12704)

* Don’t break gradient functions when following `calc()`

* Don’t break CSS grid track names

* Update changelog
This commit is contained in:
Jordan Pittman 2024-01-03 13:03:16 -05:00
parent 08a0a6c966
commit 78fedd5cc0
3 changed files with 23 additions and 0 deletions

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Don't remove keyframe stops when using important utilities ([#12639](https://github.com/tailwindlabs/tailwindcss/pull/12639))
- Don't add spaces to gradients and grid track names when followed by `calc()` ([#12704](https://github.com/tailwindlabs/tailwindcss/pull/12704))
## [3.4.0] - 2023-12-19

View File

@ -106,6 +106,13 @@ function normalizeMathOperatorSpacing(value) {
'keyboard-inset-left',
'keyboard-inset-width',
'keyboard-inset-height',
'radial-gradient',
'linear-gradient',
'conic-gradient',
'repeating-radial-gradient',
'repeating-linear-gradient',
'repeating-conic-gradient',
]
return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match) => {
@ -161,6 +168,11 @@ function normalizeMathOperatorSpacing(value) {
result += consumeUntil([')'])
}
// Don't break CSS grid track names
else if (peek('[')) {
result += consumeUntil([']'])
}
// Handle operators
else if (
['+', '-', '*', '/'].includes(char) &&

View File

@ -87,6 +87,16 @@ let table = [
// Prevent formatting keywords
['minmax(min-content,25%)', 'minmax(min-content,25%)'],
// Prevent formatting keywords
[
'radial-gradient(calc(1+2)),radial-gradient(calc(1+2))',
'radial-gradient(calc(1 + 2)),radial-gradient(calc(1 + 2))',
],
[
'[content-start]_calc(100%-1px)_[content-end]_minmax(1rem,1fr)',
'[content-start] calc(100% - 1px) [content-end] minmax(1rem,1fr)',
],
// Misc
['color(0_0_0/1.0)', 'color(0 0 0/1.0)'],
['color(0_0_0_/_1.0)', 'color(0 0 0 / 1.0)'],