Sha256: 3305ab31dc80a6bb04394fd84cbf08775ee9f50deafc746e7e4ca1e1f6396a45

Contents?: true

Size: 521 Bytes

Versions: 10

Compression:

Stored size: 521 Bytes

Contents

require 'tilt'
# Load tilt/haml only when haml is available
begin
  require 'haml'
rescue LoadError
else
  require 'tilt/haml'
end
require_relative '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

10 entries across 10 versions & 1 rubygems

Version Path
faml-0.6.0 lib/faml/tilt.rb
faml-0.5.1 lib/faml/tilt.rb
faml-0.5.0 lib/faml/tilt.rb
faml-0.4.2 lib/faml/tilt.rb
faml-0.4.1 lib/faml/tilt.rb
faml-0.4.0 lib/faml/tilt.rb
faml-0.3.6 lib/faml/tilt.rb
faml-0.3.5 lib/faml/tilt.rb
faml-0.3.4 lib/faml/tilt.rb
faml-0.3.3 lib/faml/tilt.rb