Class: Sass::Tree::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/compass/core/sass_extensions/monkey_patches/traversal.rb

Instance Method Summary collapse

Instance Method Details

#visit_depth_first(visitor) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/compass/core/sass_extensions/monkey_patches/traversal.rb', line 5

def visit_depth_first(visitor)
  visitor.visit(self)
  visitor.down(self) if children.any? and visitor.respond_to?(:down)
  if is_a?(ImportNode) && visitor.import?(self)
    root = Sass::Engine.for_file(import, @options).to_tree
    imported_children = root.children
  end

  (imported_children || children).each do |child|
    break if visitor.respond_to?(:stop?) && visitor.stop?
    child.visit_depth_first(visitor)
  end
  visitor.up(self) if children.any?
end