Sha256: 55e6b87a73490c5d679ab6e6a23b9a6a1c06f1947e2378f7a7b9b86dbc624f15

Contents?: true

Size: 938 Bytes

Versions: 2

Compression:

Stored size: 938 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,
        :style => :expanded,
        :load_paths => [ scope.pathname ]
      }
      
      if scope.site.cache_location
        options[:cache_location] = File.join(scope.site.cache_location, 'sass-cache')
      end      
      
      ::Sass::Engine.new(data, options).render
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plate-0.5.4 lib/plate/sass_template.rb
plate-0.5.3 lib/plate/sass_template.rb