Class: Sass::Tree::RootNode

Inherits:
Node
  • Object
show all
Defined in:
lib/sass/tree/root_node.rb

Overview

A static node that is the root node of the Sass document.

Direct Known Subclasses

ImportNode

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #filename, #has_children, #line, #options

Instance Method Summary collapse

Methods inherited from Node

#<<, #==, #balance, #deep_copy, #do_extend, #each, #invisible?, #style, #to_s, #to_sass, #to_scss

Constructor Details

#initialize(template) ⇒ RootNode

Returns a new instance of RootNode.

Parameters:

  • template (String)

    The Sass template from which this node was created



11
12
13
14
# File 'lib/sass/tree/root_node.rb', line 11

def initialize(template)
  super()
  @template = template
end

Instance Attribute Details

#template (readonly)

The Sass template from which this node was created

Parameters:

  • template (String)


8
9
10
# File 'lib/sass/tree/root_node.rb', line 8

def template
  @template
end

Instance Method Details

#render

Runs the dynamic Sass code and computes the CSS for the tree.

See Also:



18
19
20
21
22
23
24
25
# File 'lib/sass/tree/root_node.rb', line 18

def render
  Visitors::CheckNesting.visit(self)
  result = Visitors::Perform.visit(self)
  Visitors::CheckNesting.visit(result) # Check again to validate mixins
  result, extends = Visitors::Cssize.visit(result)
  result = result.do_extend(extends) unless extends.empty?
  result.to_s
end