2008-10-15 20:36:39 -07:00
|
|
|
module Sass
|
|
|
|
module Tree
|
2009-04-25 12:36:33 -07:00
|
|
|
# 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.
|
2008-10-15 20:36:39 -07:00
|
|
|
class FileNode < Node
|
2009-04-25 12:36:33 -07:00
|
|
|
# @param filename [String] The name of the imported file
|
|
|
|
# @param children [Array<Tree::Node>] The first-level child nodes
|
|
|
|
# of the imported file's parse tree
|
|
|
|
# @param options [Hash<Symbol, Object>] An options hash;
|
|
|
|
# see [the Sass options documentation](../../Sass.html#sass_options)
|
2008-10-15 20:36:39 -07:00
|
|
|
def initialize(filename, children, options)
|
|
|
|
@filename = filename
|
|
|
|
super(options)
|
|
|
|
self.children = children
|
|
|
|
end
|
|
|
|
|
2009-04-25 12:36:33 -07:00
|
|
|
# Computes the CSS for the imported file.
|
|
|
|
#
|
|
|
|
# @param args [Array] Ignored
|
2008-10-15 20:36:39 -07:00
|
|
|
def to_s(*args)
|
|
|
|
super()
|
|
|
|
rescue Sass::SyntaxError => e
|
|
|
|
e.add_backtrace_entry(@filename)
|
|
|
|
raise e
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
2009-04-25 12:36:33 -07:00
|
|
|
# Run the dynamic Sass for the imported file.
|
|
|
|
#
|
|
|
|
# @param environment [Sass::Environment] The lexical environment containing
|
|
|
|
# variable and mixin values
|
2008-10-15 20:36:39 -07:00
|
|
|
def perform!(environment)
|
|
|
|
self.children = perform_children(environment)
|
|
|
|
rescue Sass::SyntaxError => e
|
|
|
|
e.add_backtrace_entry(@filename)
|
|
|
|
raise e
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|