Class Sass::Tree::ImportNode
In: lib/sass/tree/import_node.rb
Parent: Node
Haml::Util Engine Color SyntaxError UnitConversionError StandardError Node Operation Literal UnaryOperation Funcall Variable Number String Bool EvaluationContext Node\n[lib/sass/css.rb\nlib/sass/tree/node.rb] DebugNode IfNode CommentNode ForNode MixinNode VariableNode ImportNode WhileNode MixinDefNode Repl CSS Environment Lexer Parser PropNode\n[lib/sass/css.rb\nlib/sass/tree/prop_node.rb] DirectiveNode\n[lib/sass/css.rb\nlib/sass/tree/directive_node.rb] RuleNode\n[lib/sass/css.rb\nlib/sass/tree/rule_node.rb] Rack lib/sass/repl.rb lib/sass/css.rb lib/sass/environment.rb lib/sass/error.rb lib/sass/engine.rb lib/sass/script/lexer.rb lib/sass/script/color.rb lib/sass/script/string.rb lib/sass/script/unary_operation.rb lib/sass/script/variable.rb lib/sass/script/funcall.rb lib/sass/script/operation.rb lib/sass/script/bool.rb lib/sass/script/parser.rb lib/sass/script/literal.rb lib/sass/script/node.rb lib/sass/script/number.rb lib/sass/script/functions.rb Functions Script Files lib/sass/tree/while_node.rb lib/sass/tree/if_node.rb lib/sass/tree/mixin_def_node.rb lib/sass/tree/debug_node.rb lib/sass/tree/for_node.rb lib/sass/tree/import_node.rb lib/sass/tree/prop_node.rb lib/sass/tree/node.rb lib/sass/tree/comment_node.rb lib/sass/tree/mixin_node.rb lib/sass/tree/directive_node.rb lib/sass/tree/rule_node.rb lib/sass/tree/variable_node.rb Tree lib/sass/plugin/rack.rb Plugin Sass dot/m_54_0.png

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.

Methods

import   import_paths   invisible?   new   perform!   to_s  

Public Class methods

@param imported_filename [String] The name of the imported file

[Source]

    # File lib/sass/tree/import_node.rb, line 8
 8:       def initialize(imported_filename)
 9:         @imported_filename = imported_filename
10:         super()
11:       end

Public Instance methods

[Source]

    # File lib/sass/tree/import_node.rb, line 23
23:       def invisible?; to_s.empty?; end

Computes the CSS for the imported file.

@param args [Array] Ignored

[Source]

    # File lib/sass/tree/import_node.rb, line 16
16:       def to_s(*args)
17:         @to_s ||= (style == :compressed ? super().strip : super())
18:       rescue Sass::SyntaxError => e
19:         e.add_backtrace_entry(@filename)
20:         raise e
21:       end

Protected Instance methods

Parses the imported file and runs the dynamic Sass for it.

@param environment [Sass::Environment] The lexical environment containing

  variable and mixin values

[Source]

    # 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

Private Instance methods

[Source]

    # 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

[Source]

    # File lib/sass/tree/import_node.rb, line 43
43:       def import_paths
44:         paths = (@options[:load_paths] || []).dup
45:         paths.unshift(File.dirname(@options[:filename])) if @options[:filename]
46:         paths
47:       end

[Validate]