Class: Malt::Engine::Less

Inherits:
Abstract show all
Defined in:
lib/malt/engines/less.rb

Overview

LESS is an extension of CSS. You can write LESS code just like you would write CSS, except you need to compile it to CSS.

Instance Attribute Summary

Attributes inherited from Abstract

#settings

Instance Method Summary collapse

Methods inherited from Abstract

#cache?, default, #initialize, #prepare_engine, register, type

Constructor Details

This class inherits a constructor from Malt::Engine::Abstract

Instance Method Details

#create_engine(params = {}) ⇒ Object


27
28
29
30
31
32
# File 'lib/malt/engines/less.rb', line 27

def create_engine(params={})
  text, file = parameters(params, :text, :file)
  cached(text, file) do
    ::Less::Parser.new(:filename=>file).parse(text)
  end
end

#render(params = {}) ⇒ Object


15
16
17
18
19
20
21
22
23
24
# File 'lib/malt/engines/less.rb', line 15

def render(params={})
  into, text, compress = parameters(params, :to, :text, :compress)

  case into
  when :css, nil
    prepare_engine(params).to_css(:compress=>compress)
  else
    super(params)
  end
end