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
- #_cssize(*args) protected
-
#_perform(environment)
protected
Returns a static DirectiveNode if this is importing a CSS file, or parses and includes the imported Sass file.
-
#initialize(imported_filename) ⇒ ImportNode
constructor
A new instance of ImportNode.
- #invisible? ⇒ Boolean
-
#perform!(environment, full_filename)
protected
Parses the imported file and runs the dynamic Sass for it.
Methods inherited from RootNode
#_to_s, #cssize, #cssize!, #perform, #to_s
Methods inherited from Node
#<<, #==, #_to_s, #balance, #cssize, #cssize!, #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
#_cssize(*args) (protected)
18 19 20 21 22 23 24 |
# File 'lib/sass/tree/import_node.rb', line 18
def _cssize(*args)
super.children
rescue Sass::SyntaxError => e
e.modify_backtrace(:filename => children.first.filename)
e.add_backtrace(:filename => @filename, :line => @line)
raise e
end
|
#_perform(environment) (protected)
Returns a static DirectiveNode if this is importing a CSS file, or parses and includes the imported Sass file.
31 32 33 34 35 36 37 38 |
# File 'lib/sass/tree/import_node.rb', line 31
def _perform(environment)
full_filename = import
return DirectiveNode.new("@import url(#{full_filename})") if full_filename =~ /\.css$/
node = dup
node.perform!(environment, full_filename)
node
end
|
#invisible? ⇒ Boolean
13 |
# File 'lib/sass/tree/import_node.rb', line 13
def invisible?; to_s.empty?; end
|
#perform!(environment, full_filename) (protected)
Parses the imported file and runs the dynamic Sass for it.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/sass/tree/import_node.rb', line 45
def perform!(environment, full_filename)
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
|