Skip to content

Commit

Permalink
Support no return in matchUtilities
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwathan committed May 4, 2021
1 parent 165787d commit 0514672
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/jit/lib/setupContext.js
Expand Up @@ -549,6 +549,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
},
})
)
.filter(Boolean)
.map((declaration) => ({
[nameClass(identifier, modifier)]: declaration,
}))
Expand Down
20 changes: 14 additions & 6 deletions src/util/processPlugins.js
Expand Up @@ -112,15 +112,23 @@ export default function (plugins, config) {
let modifierValues = Object.entries(values)

let result = Object.entries(matches).flatMap(([name, utilityFunction]) => {
return modifierValues.map(([modifier, value]) => {
return {
[nameClass(name, modifier)]: utilityFunction(value, {
return modifierValues
.map(([modifier, value]) => {
let declarations = utilityFunction(value, {
includeRules(rules, options) {
addUtilities(rules, options)
},
}),
}
})
})

if (!declarations) {
return null
}

return {
[nameClass(name, modifier)]: declarations,
}
})
.filter(Boolean)
})

addUtilities(result, { variants, respectPrefix, respectImportant })
Expand Down

0 comments on commit 0514672

Please sign in to comment.