Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix childless custom at-rules nested in bubbling at-rules
  • Loading branch information
bsak-shell committed Jul 27, 2021
commit c3c0b6b6eee9c84804f69e406670d229a1e427ce
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ function atruleChilds (rule, atrule, bubbling) {
} else if (child.type === 'rule' && bubbling) {
child.selectors = selectors(rule, child)
} else if (child.type === 'atrule') {
atruleChilds(rule, child, bubbling)
if (child.nodes) {
atruleChilds(rule, child, bubbling)
} else {
children.push(child)
}
}
})
if (bubbling) {
Expand Down
4 changes: 2 additions & 2 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ it('unwraps at-rules with interleaved properties', () => {

it('do not move custom at-rules', () => {
run(
'.one { @mixin test; } .two { @phone { color: black } }',
'.one { @mixin test; } @phone { .two { color: black } }',
'.one { @mixin test; } .two { @media screen { @mixin test; } } .three { @phone { color: black } }',
'.one { @mixin test; } @media screen { .two { @mixin test } } @phone { .three { color: black } }',
{ bubble: ['phone'] }
)
})
Expand Down