Class: PrecompiledHaml::Plugin

Inherits:
Haml::Plugin
  • Object
show all
Defined in:
lib/precompiled_haml/plugin.rb

Instance Method Summary collapse

Instance Method Details

#compile(template) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/precompiled_haml/plugin.rb', line 3

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