lib/frank/tilt.rb in frank-0.1.0 vs lib/frank/tilt.rb in frank-0.1.1

- old
+ new

@@ -1,7 +1,7 @@ module Tilt - VERSION = '0.4' + VERSION = '0.5' @template_mappings = {} # Hash of template path pattern => template implementation # class mappings. @@ -323,10 +323,29 @@ end end register 'sass', SassTemplate + # Lessscss template implementation. See: + # http://lesscss.org/ + # + # Less templates do not support object scopes, locals, or yield. + class LessTemplate < Template + def initialize_engine + require_template_library 'less' unless defined? ::Less::Engine + end + + def compile! + @engine = ::Less::Engine.new(data) + end + + def evaluate(scope, locals, &block) + @engine.to_css + end + end + register 'less', LessTemplate + # Builder template implementation. See: # http://builder.rubyforge.org/ class BuilderTemplate < Template def initialize_engine require_template_library 'builder' unless defined?(::Builder) @@ -521,6 +540,6 @@ def evaluate(scope, locals, &block) @engine end end register 'coffee', CoffeeTemplate -end \ No newline at end of file +end