mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
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:
parent
3b1df0b468
commit
0f41f43e76
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue