Skip to content

Commit ba6551d

Browse files
committed
ensure we also check wether the modifier exists in the modifiers object
Before we were just checking if the `modifiers` option is `any` or an object, without actually checking that in case it is an object, the value actually existed.
1 parent 3ce68e1 commit ba6551d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/util/pluginUtils.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,20 @@ export function coerceValue(types, modifier, options, tailwindConfig) {
233233
export function* getMatchingTypes(types, rawModifier, options, tailwindConfig) {
234234
let modifiersEnabled = flagEnabled(tailwindConfig, 'generalizedModifiers')
235235

236+
let [modifier, utilityModifier] = splitUtilityModifier(rawModifier)
237+
236238
let canUseUtilityModifier =
237239
modifiersEnabled &&
238240
options.modifiers != null &&
239-
(options.modifiers === 'any' || typeof options.modifiers === 'object')
240-
241-
let [modifier, utilityModifier] = canUseUtilityModifier
242-
? splitUtilityModifier(rawModifier)
243-
: [rawModifier, undefined]
241+
(options.modifiers === 'any' ||
242+
(typeof options.modifiers === 'object' &&
243+
((utilityModifier && isArbitraryValue(utilityModifier)) ||
244+
utilityModifier in options.modifiers)))
245+
246+
if (!canUseUtilityModifier) {
247+
modifier = rawModifier
248+
utilityModifier = undefined
249+
}
244250

245251
if (utilityModifier !== undefined && modifier === '') {
246252
modifier = 'DEFAULT'

0 commit comments

Comments
 (0)