class Sass::CSS
def expand_commas(root)
-
root
(Tree::Node
) -- The parent node
def expand_commas(root) root.children.map! do |child| unless child.is_a?(Tree::RuleNode) && child.rule.first.include?(',') expand_commas(child) if child.is_a?(Tree::DirectiveNode) next child end child.rule.first.split(',').map do |rule| node = Tree::RuleNode.new([rule.strip]) node.children = child.children node end end root.children.flatten! end