Sha256: 5f7626d6f647c490baaecf2227272b55831c21bb6a5b1e357d57f726ed775c41

Contents?: true

Size: 626 Bytes

Versions: 47

Compression:

Stored size: 626 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, :hamlit],
  )

  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

47 entries across 47 versions & 1 rubygems

Version Path
hamlit-3.0.3-java lib/hamlit/template.rb
hamlit-3.0.3 lib/hamlit/template.rb
hamlit-3.0.2-java lib/hamlit/template.rb
hamlit-3.0.2 lib/hamlit/template.rb
hamlit-3.0.1-java lib/hamlit/template.rb
hamlit-3.0.1 lib/hamlit/template.rb
hamlit-3.0.0-java lib/hamlit/template.rb
hamlit-3.0.0 lib/hamlit/template.rb
hamlit-2.16.2-java lib/hamlit/template.rb
hamlit-2.16.2 lib/hamlit/template.rb
hamlit-2.16.1-java lib/hamlit/template.rb
hamlit-2.16.1 lib/hamlit/template.rb
hamlit-2.16.0-java lib/hamlit/template.rb
hamlit-2.16.0 lib/hamlit/template.rb
hamlit-2.15.2-java lib/hamlit/template.rb
hamlit-2.15.2 lib/hamlit/template.rb
hamlit-2.15.1-java lib/hamlit/template.rb
hamlit-2.15.1 lib/hamlit/template.rb
hamlit-2.15.0-java lib/hamlit/template.rb
hamlit-2.15.0 lib/hamlit/template.rb