Sha256: cfb0a74731bafddd6d6cb90e6e26ed57f9a4013c9de2f6207b5a2ebeae1c9808

Contents?: true

Size: 976 Bytes

Versions: 3

Compression:

Stored size: 976 Bytes

Contents

#          Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require 'haml/util'
require 'sass/engine'

module Ramaze
  module Template

    # Is responsible for compiling a template using the Sass CSS templating engine.
    # Can be found at: http://haml.hamptoncatlin.com/

    class Sass < Template

      ENGINES[self] = %w[ sass ]

      class << self

        # Transform via Sass templating engine

        def transform action
          if response = Response.current
            response['Content-Type'] = "text/css"
          end
          sass = wrap_compile(action)
          sass.to_css()
        end

        # Instantiates Sass::Engine with the template and sass_options trait from
        # the controller.

        def compile(action, template)
          ::Sass::Engine.new(template, action.controller.trait[:sass_options] || {})
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
ptomato-ramaze-2009.02.1 lib/ramaze/template/sass.rb
ptomato-ramaze-2009.02 lib/ramaze/template/sass.rb
ramaze-2009.03 lib/ramaze/template/sass.rb