class Sass::Tree::ImportNode
to the backtrace if an error occurs.
It doesn’t have a functional purpose other than to add the ‘@import`ed file
A static node that wraps the {Sass::Tree} for an `@import`ed file.
def _cssize(*args)
- See: Node#_cssize -
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
def _perform(environment)
-
environment
(Sass::Environment
) -- The lexical environment containing
def _perform(environment) return DirectiveNode.new("@import url(#{full_filename})") if full_filename =~ /\.css$/ super end
def cssize(*args)
- See: Node#cssize -
def cssize(*args) super.first end
def full_filename
-
(Sass::SyntaxError)
- if `filename` ends in `".sass"` or `".scss"`
Returns:
-
(String)
- The filename of the imported file.
def full_filename @full_filename ||= import end
def import
def import Sass::Files.find_file_to_import(@imported_filename, import_paths) rescue Exception => e raise SyntaxError.new(e.message, :line => self.line, :filename => @filename) end
def import_paths
def import_paths paths = (@options[:load_paths] || []).dup paths.unshift(File.dirname(@options[:filename])) if @options[:filename] paths end
def initialize(imported_filename)
-
imported_filename
(String
) -- The name of the imported file
def initialize(imported_filename) @imported_filename = imported_filename super(nil) end
def invisible?; to_s.empty?; end
def invisible?; to_s.empty?; end
def perform!(environment)
-
environment
(Sass::Environment
) -- The lexical environment containing
def perform!(environment) environment.push_frame(:filename => @filename, :line => @line) options = @options.dup options.delete(:syntax) 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 ensure environment.pop_frame end
def to_sass(tabs = 0, opts = {})
- See: Node#to_sass -
def to_sass(tabs = 0, opts = {}) "#{' ' * tabs}@import #{@imported_filename}\n" end
def to_scss(tabs = 0, opts = {})
- See: Node#to_scss -
def to_scss(tabs = 0, opts = {}) "#{' ' * tabs}@import \"#{@imported_filename}\";\n" end