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) if path = css_import? return DirectiveNode.new("@import url(#{path})") end super end
def css_import?
-
(Boolean)- Whether or not this is a simple CSS @import declaration.
def css_import? if @imported_filename =~ /\.css$/ @imported_filename elsif imported_file.is_a?(String) && imported_file =~ /\.css$/ imported_file end end
def cssize(*args)
- See: Node#cssize -
def cssize(*args) super.first end
def import
def import paths = @options[:load_paths] if @options[:importer] f = @options[:importer].find_relative( @imported_filename, @options[:filename], @options.dup) return f if f end paths.each do |p| if f = p.find(@imported_filename, @options.dup) return f end end message = "File to import not found or unreadable: #{@imported_filename}.\n" if paths.size == 1 message << "Load path: #{paths.first}" else message << "Load paths:\n " << paths.join("\n ") end raise SyntaxError.new(message) rescue SyntaxError => e raise SyntaxError.new(e.message, :line => self.line, :filename => @filename) end
def imported_file
-
(Sass::SyntaxError)- If no file could be found to import.
Returns:
-
(Sass::Engine)-
def imported_file @imported_file ||= import 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) # TODO: re-enable caching root = imported_file.to_tree self.children = root.children self.children = perform_children(environment) rescue Sass::SyntaxError => e e.modify_backtrace(:filename => imported_file.options[: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