File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ export const computeUtilitySignature = new DefaultMap<
115
115
// Handle declarations
116
116
if ( node . kind === 'declaration' && node . value !== undefined ) {
117
117
if ( node . value . includes ( 'var(' ) ) {
118
+ let changed = false
118
119
let valueAst = ValueParser . parse ( node . value )
119
120
120
121
let seen = new Set < string > ( )
@@ -157,6 +158,7 @@ export const computeUtilitySignature = new DefaultMap<
157
158
// More than 1 argument means that a fallback is already present
158
159
if ( valueNode . nodes . length === 1 ) {
159
160
// Inject the fallback value into the variable lookup
161
+ changed = true
160
162
valueNode . nodes . push ( ...ValueParser . parse ( `,${ variableValue } ` ) )
161
163
}
162
164
}
@@ -169,14 +171,15 @@ export const computeUtilitySignature = new DefaultMap<
169
171
let nodeAsString = ValueParser . toCss ( valueNode . nodes ) // This could include more than just the variable
170
172
let constructedValue = `${ valueNode . nodes [ 0 ] . value } ,${ variableValue } `
171
173
if ( nodeAsString === constructedValue ) {
174
+ changed = true
172
175
replaceWith ( ValueParser . parse ( variableValue ) )
173
176
}
174
177
}
175
178
}
176
179
} )
177
180
178
181
// Replace the value with the new value
179
- node . value = ValueParser . toCss ( valueAst )
182
+ if ( changed ) node . value = ValueParser . toCss ( valueAst )
180
183
}
181
184
182
185
// Very basic `calc(…)` constant folding to handle the spacing scale
You can’t perform that action at this time.
0 commit comments