Sha256: 0ba41e1278dc101c4aff6ad02f43b97f6623932e86de9aebdfe976d277ebfe1a

Contents?: true

Size: 529 Bytes

Versions: 4

Compression:

Stored size: 529 Bytes

Contents

require 'opal/builder_processors'

module Opal
  module Haml
    class HamlProcessor < Opal::BuilderProcessors::RubyProcessor
      handles :haml

      def initialize(*args)
        super
        @source = prepare(@source, @filename)
      end

      def requires
        ['opal-haml'] + super
      end

      def prepare(source, path)
        haml = ::Haml::Engine.new(source, :ugly => true).precompiled
        haml = haml.gsub('_hamlout.buffer', '_hamlout')

        ::Opal::Haml.wrap haml, path
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opal-haml-0.4.2 lib/opal/haml/builder.rb
opal-haml-0.4.1 lib/opal/haml/builder.rb
opal-haml-0.4.0 lib/opal/haml/builder.rb
opal-haml-0.3.0 lib/opal/haml/builder.rb