Sha256: 663a0564b39d17b790a9f08db2b6eb8b45f066efdb638f032be03815c656b9dd

Contents?: true

Size: 911 Bytes

Versions: 3

Compression:

Stored size: 911 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plate-0.5.2 lib/plate/sass_template.rb
plate-0.5.1 lib/plate/sass_template.rb
plate-0.5.0 lib/plate/sass_template.rb