Sha256: 9e455c9fb283ac3ed26f026ae9d9041819e36df2f605ee0497e80cf11bda6969
Contents?: true
Size: 746 Bytes
Versions: 7
Compression:
Stored size: 746 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 if Sprockets.respond_to? :register_transformer extra_args = [{mime_type: 'application/javascript', silence_deprecation: true}] else extra_args = [] end Tilt.register 'opalerb', Opal::ERB::Processor Sprockets.register_engine '.opalerb', Opal::ERB::Processor, *extra_args
Version data entries
7 entries across 7 versions & 1 rubygems