Sha256: a0c1fbf8c932858bf22a15c7bbe312472ae944aa8550424a4c407871d3a33582

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

module PrecompiledHaml
  class Plugin < Haml::Plugin
    def compile(template)
      options = Haml::Template.options.dup
      if (ActionPack::VERSION::MAJOR >= 4) && template.respond_to?(:type)
        options[:mime_type] = template.type
      elsif template.respond_to? :mime_type
        options[:mime_type] = template.mime_type
      end
      options[:filename] = template.identifier
      PrecompiledHaml::Engine.new(template.source, options).compiler.precompiled_with_ambles([])
    end
  end
end

ActionView::Template.register_template_handler(:precompiled_haml, PrecompiledHaml::Plugin)
ActionController::Base.prepend_view_path(Rails.root.join('app/precompiled_views'))

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
precompiled_haml-0.0.1 lib/precompiled_haml/plugin.rb