| Class | Sass::Tree::ImportNode |
| In: |
lib/sass/tree/import_node.rb
|
| Parent: | Node |
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.
@param imported_filename [String] The name of the imported file
# File lib/sass/tree/import_node.rb, line 8
8: def initialize(imported_filename)
9: @imported_filename = imported_filename
10: super()
11: end
Parses the imported file and runs the dynamic Sass for it.
@param environment [Sass::Environment] The lexical environment containing
variable and mixin values
# File lib/sass/tree/import_node.rb, line 32
32: def perform!(environment)
33: return unless full_filename = import
34: self.children = Sass::Files.tree_for(full_filename, @options).children
35: self.children = perform_children(environment)
36: rescue Sass::SyntaxError => e
37: e.add_backtrace_entry(@filename)
38: raise e
39: end
# File lib/sass/tree/import_node.rb, line 49
49: def import
50: begin
51: full_filename = Sass::Files.find_file_to_import(@imported_filename, import_paths)
52: rescue Exception => e
53: raise SyntaxError.new(e.message, self.line)
54: end
55:
56: if full_filename =~ /\.css$/
57: @to_s = "@import url(#{full_filename});"
58: return false
59: end
60:
61: return full_filename
62: end