Skip to content

Conversation

@demikhovr
Copy link
Contributor

No description provided.

@demikhovr
Copy link
Contributor Author

There's also another possible solution:

function pickDeclarations (child) {
  var result = []
  var next = child.next()

  while (next && next.type === 'decl') {
    result.push(next)
    next = next.next()
  }

  return result
}

function processRule (rule, bubble, unwrap, preserveEmpty) {
...
if (child.type === 'rule') {
  unwrapped = true
  child.selectors = selectors(rule, child)
  after = pickComment(child.prev(), after)
  var decls = pickDeclarations(child)
  after.after(child)
  after = child

  if (decls.length) {
    var parent = postcss.rule({
      selector: rule.selector,
      nodes: []
    })

    for (var i = 0; i < decls.length; i++) {
      parent.append(decls[i])
    }

    after.after(parent)
    after = parent
  }
}
...

@ai ai merged commit 2a9ac5a into postcss:master Jul 4, 2020
@ai
Copy link
Member

ai commented Jul 4, 2020

Released in 4.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants