module Sass::Files
def tree_for(filename, options)
-
(Sass::SyntaxError)
- if there's an error in the document.
Parameters:
-
options
({Symbol => Object}
) -- The options hash. -
filename
(String
) -- The path to the Sass or SCSS file
def tree_for(filename, options) default_options = Sass::Engine::DEFAULT_OPTIONS.dup default_options.delete(:syntax) options = default_options.merge!(options) text = File.read(filename) if options[:cache] || options[:read_cache] compiled_filename = sassc_filename(filename, options) sha = Digest::SHA1.hexdigest(text) if root = try_to_read_sassc(filename, compiled_filename, sha) root.options = options.merge(:filename => filename) return root end end options = options.merge(:filename => filename) if filename =~ /\.scss$/ options = {:syntax => :scss}.merge(options) elsif filename =~ /\.sass$/ options = {:syntax => :sass}.merge(options) end engine = Sass::Engine.new(text, options) root = engine.to_tree try_to_write_sassc(root, compiled_filename, sha, options) if options[:cache] root end