Fix formatting
This commit is contained in:
parent
c98cc12d35
commit
de1884fdd9
1 changed files with 9 additions and 8 deletions
|
|
@ -1,11 +1,12 @@
|
|||
function indentRecursive(node, indentLevel = 0) {
|
||||
node.each && node.each((child, i) => {
|
||||
if (!child.raws.before || child.raws.before.includes('\n')) {
|
||||
child.raws.before = `${ node.type === 'rule' || i === 0 ? '\n' : '\n\n'}${' '.repeat(indentLevel)}`
|
||||
}
|
||||
child.raws.after = `\n${' '.repeat(indentLevel)}`
|
||||
indentRecursive(child, indentLevel + 1)
|
||||
})
|
||||
function indentRecursive(node, indent = 0) {
|
||||
node.each &&
|
||||
node.each((child, i) => {
|
||||
if (!child.raws.before || child.raws.before.includes('\n')) {
|
||||
child.raws.before = `\n${node.type !== 'rule' && i > 0 ? '\n' : ''}${' '.repeat(indent)}`
|
||||
}
|
||||
child.raws.after = `\n${' '.repeat(indent)}`
|
||||
indentRecursive(child, indent + 1)
|
||||
})
|
||||
}
|
||||
|
||||
export default function formatNodes(root) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue