Sha256: 9a85a5473c898eb0338427ce76a2fd23c92d3fc3a5156ed5edb25a1f801c336d

Contents?: true

Size: 633 Bytes

Versions: 2

Compression:

Stored size: 633 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

module SprocketsIIFE
  class Railtie < Rails::Railtie
    def configure_assets(app)
      if config.respond_to?(:assets) && config.assets.respond_to?(:configure)
        # Rails 4.x
        config.assets.configure { |env| yield(env) }
      else
        # Rails 3.2
        yield(app.assets)
      end
    end

    initializer 'sprockets.iife', group: :all, after: 'sprockets.environment' do |app|
      configure_assets(app) do |env|
        # Sprockets 2, 3, and 4
        env.register_bundle_processor 'application/javascript', SprocketsIIFE::Processor
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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