Skip to content

Commit 78fedd5

Browse files
committed
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
1 parent 08a0a6c commit 78fedd5

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Fixed
1111

1212
- Don't remove keyframe stops when using important utilities ([#12639](https://github.com/tailwindlabs/tailwindcss/pull/12639))
13+
- Don't add spaces to gradients and grid track names when followed by `calc()` ([#12704](https://github.com/tailwindlabs/tailwindcss/pull/12704))
1314

1415
## [3.4.0] - 2023-12-19
1516

src/util/dataTypes.js

+12
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ function normalizeMathOperatorSpacing(value) {
106106
'keyboard-inset-left',
107107
'keyboard-inset-width',
108108
'keyboard-inset-height',
109+
110+
'radial-gradient',
111+
'linear-gradient',
112+
'conic-gradient',
113+
'repeating-radial-gradient',
114+
'repeating-linear-gradient',
115+
'repeating-conic-gradient',
109116
]
110117

111118
return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match) => {
@@ -161,6 +168,11 @@ function normalizeMathOperatorSpacing(value) {
161168
result += consumeUntil([')'])
162169
}
163170

171+
// Don't break CSS grid track names
172+
else if (peek('[')) {
173+
result += consumeUntil([']'])
174+
}
175+
164176
// Handle operators
165177
else if (
166178
['+', '-', '*', '/'].includes(char) &&

tests/normalize-data-types.test.js

+10
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ let table = [
8787
// Prevent formatting keywords
8888
['minmax(min-content,25%)', 'minmax(min-content,25%)'],
8989

90+
// Prevent formatting keywords
91+
[
92+
'radial-gradient(calc(1+2)),radial-gradient(calc(1+2))',
93+
'radial-gradient(calc(1 + 2)),radial-gradient(calc(1 + 2))',
94+
],
95+
[
96+
'[content-start]_calc(100%-1px)_[content-end]_minmax(1rem,1fr)',
97+
'[content-start] calc(100% - 1px) [content-end] minmax(1rem,1fr)',
98+
],
99+
90100
// Misc
91101
['color(0_0_0/1.0)', 'color(0 0 0/1.0)'],
92102
['color(0_0_0_/_1.0)', 'color(0 0 0 / 1.0)'],

0 commit comments

Comments
 (0)