Only wrap with variants if rules don't already contain any variants
This commit is contained in:
parent
3f6d31e3ae
commit
7dc0261bc6
2 changed files with 37 additions and 0 deletions
|
|
@ -2,6 +2,16 @@ import postcss from 'postcss'
|
|||
import cloneNodes from './cloneNodes'
|
||||
|
||||
export default function wrapWithVariants(rules, variants) {
|
||||
let foundVariantAtRule = false
|
||||
|
||||
postcss.root({ nodes: rules }).walkAtRules('variants', () => {
|
||||
foundVariantAtRule = true
|
||||
})
|
||||
|
||||
if (foundVariantAtRule) {
|
||||
return cloneNodes(rules)
|
||||
}
|
||||
|
||||
return postcss
|
||||
.atRule({
|
||||
name: 'variants',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue