Don't mutate nested rules when generating variants

This commit is contained in:
Adam Wathan 2019-07-28 10:46:59 -04:00
parent 27a9cd9456
commit 660ea44db2
2 changed files with 42 additions and 1 deletions

View file

@ -12,7 +12,11 @@ export default function generateVariantFunction(generator) {
container: cloned,
separator: config.separator,
modifySelectors: modifierFunction => {
cloned.walkRules(rule => {
cloned.each(rule => {
if (rule.type !== 'rule') {
return
}
rule.selectors = rule.selectors.map(selector => {
const className = selectorParser(selectors => {
return selectors.first.filter(({ type }) => type === 'class').pop().value