Sha256: 89d9e27bfb96a5a3951e4bad30c63d7ed166839be26f01a878e7dacd5b79ae44
Contents?: true
Size: 966 Bytes
Versions: 14
Compression:
Stored size: 966 Bytes
Contents
module Plate # Slightly modified from the Tilt default to just use the Less::Parse instead of Engine. # # Also adds support for paths # # Original source: https://github.com/rtomayko/tilt/blob/master/lib/tilt/css.rb class LessTemplate < Tilt::Template self.default_mime_type = 'text/css' def self.engine_initialized? defined? ::Less end def initialize_engine require_template_library 'less' end def prepare end def evaluate(scope, locals, &block) paths = [ scope.pathname, File.join(scope.site.source, 'content') ] less_options = options.merge({ :filename => eval_file, :line => line, :paths => paths }) partials = data.to_s.scan(/@import\s"(.*?)";/i).flatten.collect { |s| s.split('/').last.gsub(/^_/, '') } scope.partials = scope.partials + partials parser = ::Less::Parser.new(less_options) parser.parse(data).to_css end end end
Version data entries
14 entries across 14 versions & 1 rubygems