module Plate # Mostly lifted from the default SassTemplate class at # https://github.com/rtomayko/tilt/blob/master/lib/tilt/css.rb # # Modifications have been made to use the site caching folder class SassTemplate < Tilt::Template self.default_mime_type = 'text/css' def self.engine_initialized? defined? ::Sass::Engine end def initialize_engine require_template_library 'sass' end def prepare end def syntax :sass end def evaluate(scope, locals, &block) options = { :filename => eval_file, :line => line, :syntax => syntax } locals ||= {} if locals[:site] and locals[:site].cache_location options[:cache_location] = File.join(locals[:site].cache_location, 'sass-cache') end ::Sass::Engine.new(data, options).render end end end