Sha256: dc97901413dcdba459613d00dc7433ef51fcfe97b139269dd69ed3d4943fd141

Contents?: true

Size: 551 Bytes

Versions: 9

Compression:

Stored size: 551 Bytes

Contents

# frozen-string-literal: true
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

9 entries across 9 versions & 1 rubygems

Version Path
faml-0.7.3 lib/faml/tilt.rb
faml-0.7.2 lib/faml/tilt.rb
faml-0.7.1 lib/faml/tilt.rb
faml-0.7.0 lib/faml/tilt.rb
faml-0.6.5 lib/faml/tilt.rb
faml-0.6.4 lib/faml/tilt.rb
faml-0.6.3 lib/faml/tilt.rb
faml-0.6.2 lib/faml/tilt.rb
faml-0.6.1 lib/faml/tilt.rb