Sha256: a58949800009947339cb475eccf3adf6738c96175b415baadf7cbb6e610fce40

Contents?: true

Size: 827 Bytes

Versions: 2

Compression:

Stored size: 827 Bytes

Contents

require 'malt/engines/abstract'

module Malt::Engine

  # Sass Malt Engine
  #
  class Sass < Abstract

    default :sass, :scss

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

      case into
      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

2 entries across 2 versions & 1 rubygems

Version Path
malt-0.3.0 lib/malt/engines/sass.rb
malt-0.2.0 lib/malt/engines/sass.rb