Sha256: 2544ed0e45db870c354147e81d197ebae6f68d00af5f39ce2e7761f22bdd7685

Contents?: true

Size: 440 Bytes

Versions: 1

Compression:

Stored size: 440 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

require 'sprockets-iife/template'

module SprocketsIIFE
  class << self
    def wrap(script_path, script_source)
      script_iife_path = File.join(File.dirname(script_path), "#{File.basename(script_path, '.*')}-iife.js.erb")

      if File.readable?(script_iife_path)
        Template.new(script_iife_path, script_source).result
      else
        script_source
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sprockets-iife-1.1.0 lib/sprockets-iife/wrap.rb