lib/opal/haml.rb in opal-haml-0.3.0 vs lib/opal/haml.rb in opal-haml-0.4.0

- old
+ new

@@ -4,16 +4,21 @@ require 'opal/haml/version' module Opal module Haml def self.compile(source, file = '(haml)') + Opal.compile(compile_haml(source, file)) + end + + def self.compile_haml(source, file) haml = ::Haml::Engine.new(source, :ugly => true).precompiled haml = haml.gsub('_hamlout.buffer', '_hamlout') - Opal.compile(wrap(haml, file)) + wrap(haml, file) end def self.wrap(haml, file) <<-EOS + require 'opal-haml' Template.new('#{file}') do |_hamlout| #{haml} _hamlout.join end EOS