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

#compiled_path, #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)


27
28
29
# File 'lib/tilt/less.rb', line 27

def allows_script?
  false
end

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



23
24
25
# File 'lib/tilt/less.rb', line 23

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

#prepareObject



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

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