Sha256: 48698685934cdf933cd3908e219bcef671951b8c88aaab4819a2be79b728c3c1

Contents?: true

Size: 548 Bytes

Versions: 2

Compression:

Stored size: 548 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

module SprocketsIIFE
  class Processor
    include Singleton

    class << self
      def call(input)
        instance.call(input)
      end
    end

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

    def source
      @input[:data]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sprockets-iife-1.0.2 lib/sprockets-iife/processor.rb
sprockets-iife-1.0.1 lib/sprockets-iife/processor.rb