Class: Sass::Tree::ImportNode
- Defined in:
- lib/sass/tree/import_node.rb
Overview
A static node that wraps the Sass::Tree for an @import
ed file.
It doesn't have a functional purpose other than to add the @import
ed file
to the backtrace if an error occurs.
Instance Attribute Summary
Attributes inherited from RootNode
Attributes inherited from Node
#children, #filename, #line, #options
Instance Method Summary collapse
-
#_to_s(*args) ⇒ Object
protected
Computes the CSS for the imported file.
-
#initialize(imported_filename) ⇒ ImportNode
constructor
A new instance of ImportNode.
- #invisible? ⇒ Boolean
-
#perform!(environment) ⇒ Object
protected
Parses the imported file and runs the dynamic Sass for it.
Methods inherited from RootNode
Methods inherited from Node
#<<, #==, #_perform, #balance, #interpolate, #invalid_child?, #last, #perform, #perform_children, #render, #style, #to_s, #to_sass
Constructor Details
#initialize(imported_filename) ⇒ ImportNode
Returns a new instance of ImportNode.
8 9 10 11 |
# File 'lib/sass/tree/import_node.rb', line 8
def initialize(imported_filename)
@imported_filename = imported_filename
super(nil)
end
|
Instance Method Details
#_to_s(*args) ⇒ Object (protected)
Computes the CSS for the imported file.
20 21 22 23 24 25 26 |
# File 'lib/sass/tree/import_node.rb', line 20
def _to_s(*args)
@to_s ||= (style == :compressed ? super.strip : super)
rescue Sass::SyntaxError => e
e.modify_backtrace(:filename => children.first.filename)
e.add_backtrace(:filename => @filename, :line => @line)
raise e
end
|
#invisible? ⇒ Boolean
13 |
# File 'lib/sass/tree/import_node.rb', line 13
def invisible?; to_s.empty?; end
|
#perform!(environment) ⇒ Object (protected)
Parses the imported file and runs the dynamic Sass for it.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sass/tree/import_node.rb', line 33
def perform!(environment)
return unless full_filename = import
root = Sass::Files.tree_for(full_filename, @options)
@template = root.template
self.children = root.children
self.children = perform_children(environment)
rescue Sass::SyntaxError => e
e.modify_backtrace(:filename => full_filename)
e.add_backtrace(:filename => @filename, :line => @line)
raise e
end
|