Skip to content

Commit d99bba4

Browse files
committed
handle --default(…) in --modifier(…)
1 parent f29317a commit d99bba4

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

packages/tailwindcss/src/utilities.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6205,19 +6205,19 @@ export function createCssUtility(node: AtRule) {
62056205

62066206
// Modifier function, e.g.: `--modifier(integer)`
62076207
else if (fnNode.value === '--modifier') {
6208-
// If there is no modifier present in the candidate, then the
6209-
// declaration can be removed.
6210-
if (modifier === null) {
6211-
shouldRemoveDeclaration = true
6212-
return WalkAction.Stop
6213-
}
6214-
62156208
usedModifierFn = true
62166209

6217-
let replacement = resolveValueFunction(modifier, fnNode, designSystem)
6218-
if (replacement) {
6210+
let resolved = resolveValueFunction(modifier, fnNode, designSystem)
6211+
if (resolved) {
62196212
resolvedModifierFn = true
6220-
return WalkAction.ReplaceSkip(replacement.nodes)
6213+
return WalkAction.ReplaceSkip(resolved.nodes)
6214+
}
6215+
6216+
// If there is no modifier present in the candidate and no default
6217+
// value resolved, then the declaration can be removed.
6218+
if (modifier === null) {
6219+
shouldRemoveDeclaration = true
6220+
return WalkAction.Stop
62216221
}
62226222

62236223
// Drop the declaration in case we couldn't resolve the value
@@ -6239,7 +6239,7 @@ export function createCssUtility(node: AtRule) {
62396239
if (!usedValueFn || !resolvedValueFn) return null
62406240

62416241
// Used `--modifier(…)` but nothing resolved
6242-
if (usedModifierFn && !resolvedModifierFn) return null
6242+
if (usedModifierFn && !resolvedModifierFn && modifier !== null) return null
62436243

62446244
// Resolved `--value(ratio)` and `--modifier(…)`, which is invalid
62456245
if (resolvedRatioValue && resolvedModifierFn) return null

0 commit comments

Comments
 (0)