class Sass::Plugin::TemplateHandler
def self.dependencies_changed?(deps, since, lookup_context)
def self.dependencies_changed?(deps, since, lookup_context) opts = Sass::Plugin.engine_options.merge(:_rails_lookup_context => lookup_context) deps.any? do |d, i| return true unless time = i.mtime(d, opts) time.to_i > since end end
def self.munge_exception(e, lookup_context)
def self.munge_exception(e, lookup_context) importer = Sass::Importers::Rails.new opts = Sass::Plugin.engine_options.merge(:_rails_lookup_context => lookup_context) e.sass_backtrace.each do |bt| next unless engine = importer.find(bt[:filename], opts) bt[:filename] = engine.options[:_rails_filename] end end
def call(template, view)
def call(template, view) engine = Sass::Engine.new(template.source, Sass::Plugin.engine_options.merge( :syntax => @syntax, :filename => template.virtual_path, :_rails_lookup_context => view.lookup_context, :importer => Sass::Importers::Rails.new)) template.data[:sass_importers] = engine.dependencies.map do |e| [e.options[:filename], e.options[:importer]] end stylesheet = begin engine.render rescue Sass::SyntaxError => e Sass::Plugin::TemplateHandler.munge_exception e, view.lookup_context Sass::SyntaxError.exception_to_css(e, Sass::Plugin.engine_options) end <<RUBY ass::Plugin::TemplateHandler.dependencies_changed?( @_template.data[:sass_importers], #{Time.now.to_i}, lookup_context) template.expire! template.rerender(self) stylesheet.inspect} Sass::SyntaxError => e ::Plugin::TemplateHandler.munge_exception e, lookup_context ::SyntaxError.exception_to_css(e, Sass::Plugin.engine_options) end
def handles_encoding?; true; end
def handles_encoding?; true; end
def initialize(syntax)
def initialize(syntax) @syntax = syntax end