Class: Sass::Tree::FileNode
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 Node
#children, #filename, #line, #options
Instance Method Summary collapse
-
#initialize(filename) ⇒ FileNode
constructor
A new instance of FileNode.
- #invisible? ⇒ Boolean
-
#perform!(environment) ⇒ Object
protected
Parses the imported file and runs the dynamic Sass for it.
-
#to_s(*args) ⇒ Object
Computes the CSS for the imported file.
Methods inherited from Node
#<<, #==, #_perform, #balance, #interpolate, #invalid_child?, #last, #perform, #perform_children, #render, #style, #to_sass
Constructor Details
#initialize(filename) ⇒ FileNode
Returns a new instance of FileNode.
8 9 10 11 |
# File 'lib/sass/tree/file_node.rb', line 8
def initialize(filename)
@filename = filename
super()
end
|
Instance Method Details
#invisible? ⇒ Boolean
23 |
# File 'lib/sass/tree/file_node.rb', line 23
def invisible?; to_s.empty?; end
|
#perform!(environment) ⇒ Object (protected)
Parses the imported file and runs the dynamic Sass for it.
32 33 34 35 36 37 38 |
# File 'lib/sass/tree/file_node.rb', line 32
def perform!(environment)
self.children = Sass::Files.tree_for(filename, @options).children
self.children = perform_children(environment)
rescue Sass::SyntaxError => e
e.add_backtrace_entry(@filename)
raise e
end
|
#to_s(*args) ⇒ Object
Computes the CSS for the imported file.
16 17 18 19 20 21 |
# File 'lib/sass/tree/file_node.rb', line 16
def to_s(*args)
@to_s ||= (style == :compressed ? super().strip : super())
rescue Sass::SyntaxError => e
e.add_backtrace_entry(@filename)
raise e
end
|