module Opal::Haml

Constants

OPAL_SPROCKETS_PROCESSOR
VERSION

Public Class Methods

compile(source, file = '(haml)') click to toggle source
# File lib/opal/haml.rb, line 15
def self.compile(source, file = '(haml)')
  Opal.compile(compile_haml(source, file))
end
compile_haml(source, file) click to toggle source
# File lib/opal/haml.rb, line 19
def self.compile_haml(source, file)
  haml = ::Haml::Engine.new(source, @options).precompiled
  haml = haml.gsub('_hamlout.buffer', '_hamlout')
  wrap(haml, file)
end
wrap(haml, file) click to toggle source
# File lib/opal/haml.rb, line 25
    def self.wrap(haml, file)
      <<-EOS
        require 'opal-haml'
        Template.new('#{file}') do |_hamlout|
          _hamlout.extend Haml::Buffer
          #{haml}
          _hamlout.join
        end
      EOS
    end