Sha256: 7f57f43a5e9ec97be3f07f48e97f83d98dad5123782e4b17e6136bf127367d09

Contents?: true

Size: 818 Bytes

Versions: 1

Compression:

Stored size: 818 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

require 'rails/railtie'

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', after: 'sprockets.environment' do |app|
      configure_assets(app) do |env|
        # Sprockets 2, 3, and 4
        env.register_bundle_processor 'application/javascript', SprocketsIIFE::BundleProcessor
        env.register_mime_type 'application/javascript', extensions: ['.js']
        env.register_postprocessor 'application/javascript', SprocketsIIFE::ItemProcessor
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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