Sha256: 43fed95f3ebd5072e80b69bbb179219743e4e6b3ab6d0cc9d1dac77cdb29e9f3

Contents?: true

Size: 615 Bytes

Versions: 29

Compression:

Stored size: 615 Bytes

Contents

# frozen_string_literal: false
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

29 entries across 29 versions & 1 rubygems

Version Path
hamlit-2.8.2 lib/hamlit/template.rb
hamlit-2.8.1 lib/hamlit/template.rb
hamlit-2.8.0 lib/hamlit/template.rb
hamlit-2.7.5 lib/hamlit/template.rb
hamlit-2.7.3 lib/hamlit/template.rb
hamlit-2.7.2 lib/hamlit/template.rb
hamlit-2.7.1 lib/hamlit/template.rb
hamlit-2.7.0 lib/hamlit/template.rb
hamlit-2.6.2 lib/hamlit/template.rb