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, #source_range

Instance Method Summary collapse

Methods inherited from Node

#<<, #==, #balance, #bubbles?, #css, #css_with_sourcemap, #deep_copy, #each, #inspect, #invisible?, #style, #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

#renderString

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

Returns:

  • (String)

    The compiled CSS.



19
20
21
# File 'lib/sass/tree/root_node.rb', line 19

def render
  css_tree.css
end

#render_with_sourcemap(String, Sass::Source::Map)

Runs the dynamic Sass code and computes the CSS for the tree, along with the sourcemap.

Returns:

  • ((String, Sass::Source::Map))

    The compiled CSS, as well as the source map. @see #render



28
29
30
# File 'lib/sass/tree/root_node.rb', line 28

def render_with_sourcemap
  css_tree.css_with_sourcemap
end