Sha256: 659126aa12cd5e728b936311c034fe6d67c06fa19b78fafa9446e08d22a439a2

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 Bytes

Contents

require 'haml'
require 'sprockets'

module Opal
  module Haml
    class Processor < ::Opal::Processor
      self.default_mime_type = 'application/javascript'

      def evaluate(context, locals, &block)
        @data = Opal::Haml.compile_haml @data, context.logical_path.sub(/^templates\//, '')
        super
      end

      def self.compiler_options
        # otherwise would check current class `attr_accessor`s
        ::Opal::Processor.compiler_options
      end
    end
  end
end

Sprockets.register_engine '.haml',  Opal::Haml::Processor

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opal-haml-0.4.1 lib/opal/haml/processor.rb
opal-haml-0.4.0 lib/opal/haml/processor.rb