Sha256: 1e2fe8d206e3c8e06de77c9a0539e6507b2d1992c010c133f2bb21d5c039e8b7

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

module SprocketsIIFE
  class Processor
    VERSION = '1'
    include Singleton

    class << self
      delegate :call, :cache_key, to: :instance
    end

    attr_reader :cache_key

    def initialize(options = {})
      @cache_key = [self.class.name, VERSION, options].freeze
    end

    def call(input)
      @input   = input
      filepath = @input[:filename]
      iife     = File.join(File.dirname(filepath), "#{File.basename(filepath, '.*')}-iife.js.erb")
      File.exists?(iife) ? ERB.new(File.read(iife)).result(binding) : input[:data]
    end

    def source
      @input[:data]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sprockets-iife-1.0 lib/sprockets-iife/processor-v3.rb