Sha256: e55b893517d6d99926f0b63bee278168e8c01156ba75a970aeb562a4e8dc4bb6

Contents?: true

Size: 584 Bytes

Versions: 6

Compression:

Stored size: 584 Bytes

Contents

require 'temple'
require 'hamlit/engine'
require 'hamlit/helpers'

# Load tilt/haml first to override if available
begin
  require 'haml'
rescue LoadError
else
  require 'tilt/haml'
end

module Hamlit
  Template = Temple::Templates::Tilt.create(
    Hamlit::Engine,
    register_as: :haml,
  )

  module TemplateExtension
    # Activate Hamlit::Helpers for tilt templates.
    # https://github.com/judofyr/temple/blob/v0.7.6/lib/temple/mixins/template.rb#L7-L11
    def compile(*)
      "extend Hamlit::Helpers; #{super}"
    end
  end
  Template.send(:extend, TemplateExtension)
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hamlit-2.6.1 lib/hamlit/template.rb
hamlit-2.6.0 lib/hamlit/template.rb
hamlit-2.5.0 lib/hamlit/template.rb
hamlit-2.4.2 lib/hamlit/template.rb
hamlit-2.4.1 lib/hamlit/template.rb
hamlit-2.4.0 lib/hamlit/template.rb