Class: Tilt::LessTemplate

Inherits:
Template show all
Defined in:
lib/tilt/less.rb

Overview

Lessscss template implementation. See: lesscss.org/

Less templates do not support object scopes, locals, or yield.

Instance Attribute Summary

Attributes inherited from Template

#data, #file, #line, #options

Instance Method Summary collapse

Methods inherited from Template

#basename, default_mime_type, default_mime_type=, #eval_file, #initialize, metadata, #metadata, #name, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Instance Method Details

#allows_script?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/tilt/less.rb', line 25

def allows_script?
  false
end

#evaluate(scope, locals, &block) ⇒ Object



21
22
23
# File 'lib/tilt/less.rb', line 21

def evaluate(scope, locals, &block)
  @output ||= @engine.to_css(options)
end

#prepareObject



12
13
14
15
16
17
18
19
# File 'lib/tilt/less.rb', line 12

def prepare
  if ::Less.const_defined? :Engine
    @engine = ::Less::Engine.new(data)
  else
    parser  = ::Less::Parser.new(options.merge :filename => eval_file, :line => line)
    @engine = parser.parse(data)
  end
end