Sha256: 7af418aaa5600e34a7dab35a0f29e828b11c61125dae8df89bd410125eb8295e

Contents?: true

Size: 876 Bytes

Versions: 1

Compression:

Stored size: 876 Bytes

Contents

require 'malt/engines/abstract'

module Malt::Engine

  # LESS
  #
  #   http://lesscss.org/
  #
  # 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. That's what this class is for.
  class Less < Abstract

    default :less

    #
    def render(params)
      text   = params[:text]
      format = params[:format]
      case format
      when :css, nil
        intermediate(params).to_css
      else
        super(params)
      end
    end

    #
    def intermediate(params)
      text = params[:text]
      ::Less::Engine.new(text)
    end

    #
    #def compile(text, file)
    #  intermediate # ??
    #end

    private

      # Load Less library if not already loaded.
      def initialize_engine
        return if defined? ::Less::Engine
        require_library 'less'
      end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
malt-0.1.1 lib/malt/engines/less.rb