class Sass::CSS

def expand_commas(root)

Parameters:
  • root (Tree::Node) -- The parent node
def expand_commas(root)
  root.children.map! do |child|
    # child.parsed_rules.members.size > 1 iff the rule contains a comma
    unless child.is_a?(Tree::RuleNode) && child.parsed_rules.members.size > 1
      expand_commas(child) if child.is_a?(Tree::DirectiveNode)
      next child
    end
    child.parsed_rules.members.map do |seq|
      node = Tree::RuleNode.new([])
      node.parsed_rules = make_cseq(seq)
      node.children = child.children
      node
    end
  end
  root.children.flatten!
end