Skip to content

Commit 47107be

Browse files
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 b52a78b commit 47107be

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
### Added
1516

src/util/dataTypes.js

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

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

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

tests/normalize-data-types.test.js

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

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

0 commit comments

Comments
 (0)