Sha256: 6accfa4c691b05e193f4afb43a19468d3182bbf482c9ed0cd40b48c0a9e1309a

Contents?: true

Size: 640 Bytes

Versions: 7

Compression:

Stored size: 640 Bytes

Contents

require 'tilt'
require 'sprockets'
require 'opal/sprockets/processor'

module Opal
  module ERB
    class Processor < ::Opal::Processor
      def initialize_engine
        super
        require_template_library 'opal/erb'
      end

      def evaluate(context, locals, &block)
        compiler = Opal::ERB::Compiler.new(@data, context.logical_path.sub(/#{REGEXP_START}templates\//, ''))
        @data = compiler.prepared_source
        super
      end
    end
  end
end

Tilt.register 'opalerb', Opal::ERB::Processor
Sprockets.register_engine '.opalerb', Opal::ERB::Processor, mime_type: 'application/javascript', silence_deprecation: true

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opal-sprockets-0.4.9.1.0.3.7 lib/opal/sprockets/erb.rb
opal-sprockets-0.4.8.1.0.3.7 lib/opal/sprockets/erb.rb
opal-sprockets-0.4.7.1.0.3.7 lib/opal/sprockets/erb.rb
opal-sprockets-0.4.6.1.0.3.7 lib/opal/sprockets/erb.rb
opal-sprockets-0.4.5.1.0.3.7 lib/opal/sprockets/erb.rb
opal-sprockets-0.4.4.1.0.3.7 lib/opal/sprockets/erb.rb
opal-sprockets-0.4.3.0.11.0.3.7 lib/opal/sprockets/erb.rb