Sha256: 5fb79f646fd76b61e24d783257247798f76380ff5236036b62adf0adbaed67c9

Contents?: true

Size: 836 Bytes

Versions: 1

Compression:

Stored size: 836 Bytes

Contents

require 'malt/engines/abstract'

module Malt::Engines

  # Sass Malt Engine
  #
  class Sass < Abstract

    default :sass, :scss

    #
    def render(params, &yld)
      text   = params[:text]
      file   = params[:file]
      format = params[:format]

      case format
      when :css, nil
        engine = intermediate(params)
        engine.render
      else
        super(params, &yld)
      end
    end

    #
    def intermediate(params)
      text = params[:text]
      file = params[:file]
      type = params[:type]
      ::Sass::Engine.new(text, :filename=>file, :syntax=>type)
    end

    private

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

    def engine_options
      opts = {}
      opts
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
malt-0.1.0 lib/malt/engines/sass.rb