Sha256: 630bb19b768172b0ad675de3e0044a484de558c5ba9680087652a3cff13fe612

Contents?: true

Size: 516 Bytes

Versions: 3

Compression:

Stored size: 516 Bytes

Contents

require 'tilt'
# Load tilt/haml only when haml is available
begin
  require 'haml'
rescue LoadError
else
  require 'tilt/haml'
end
require 'faml/engine'

module Faml
  class Tilt < Tilt::Template
    def prepare
      filename = nil
      if file
        filename = File.expand_path(file)
      end
      @code = Engine.new(options.merge(filename: filename)).call(data)
    end

    def precompiled_template(locals = {})
      @code
    end
  end

  ::Tilt.register(Tilt, 'haml')
  ::Tilt.register(Tilt, 'faml')
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
faml-0.3.1 lib/faml/tilt.rb
faml-0.3.0 lib/faml/tilt.rb
faml-0.2.16 lib/faml/tilt.rb