Skip to content

Commit

Permalink
ensure we also check wether the modifier exists in the modifiers object
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
RobinMalfait committed Oct 21, 2022
1 parent 3ce68e1 commit ba6551d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/util/pluginUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,20 @@ export function coerceValue(types, modifier, options, tailwindConfig) {
export function* getMatchingTypes(types, rawModifier, options, tailwindConfig) {
let modifiersEnabled = flagEnabled(tailwindConfig, 'generalizedModifiers')

let [modifier, utilityModifier] = splitUtilityModifier(rawModifier)

let canUseUtilityModifier =
modifiersEnabled &&
options.modifiers != null &&
(options.modifiers === 'any' || typeof options.modifiers === 'object')

let [modifier, utilityModifier] = canUseUtilityModifier
? splitUtilityModifier(rawModifier)
: [rawModifier, undefined]
(options.modifiers === 'any' ||
(typeof options.modifiers === 'object' &&
((utilityModifier && isArbitraryValue(utilityModifier)) ||
utilityModifier in options.modifiers)))

if (!canUseUtilityModifier) {
modifier = rawModifier
utilityModifier = undefined
}

if (utilityModifier !== undefined && modifier === '') {
modifier = 'DEFAULT'
Expand Down

0 comments on commit ba6551d

Please sign in to comment.