Fixing the rule flattening for css2sass.

git-svn-id: svn://hamptoncatlin.com/haml/trunk@700 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2007-12-16 22:20:47 +00:00
parent 3b1df0b468
commit 0f41f43e76
1 changed files with 2 additions and 2 deletions

View File

@ -244,13 +244,13 @@ module Sass
# color: red
#
def flatten_rules(root)
root.children.each { |child| flatten_rules(child) if child.is_a?(Tree::RuleNode) }
root.children.each { |child| flatten_rule(child) if child.is_a?(Tree::RuleNode) }
end
def flatten_rule(rule)
while rule.children.size == 1 && rule.children.first.is_a?(Tree::RuleNode)
child = rule.children.first
rule.rule = "#{root.rule} #{child.rule}"
rule.rule = "#{rule.rule} #{child.rule}"
rule.children = child.children
end