Sha256: b411bb793cc81dd53bb54b11f50bb11337fe52f712166c5fae0b8c1b3ed0ade6

Contents?: true

Size: 753 Bytes

Versions: 2

Compression:

Stored size: 753 Bytes

Contents

require "i18n/js"

module I18n
  module JS
    class Engine < ::Rails::Engine
      initializer :after => "sprockets.environment" do
        ActiveSupport.on_load(:after_initialize, :yield => true) do
          next unless JS.has_asset_pipeline?
          next unless Rails.configuration.assets.compile

          registry = Sprockets.respond_to?("register_preprocessor") ? Sprockets : Rails.application.assets

          registry.register_preprocessor "application/javascript", :"i18n-js_dependencies" do |context, source|
            next source unless context.logical_path == "i18n/filtered"
            ::I18n.load_path.each {|path| context.depend_on(File.expand_path(path))}
            source
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
i18n-js-pika-3.0.0.rc7 lib/i18n/js/engine.rb
i18n-js-pika-3.0.0.rc6 lib/i18n/js/engine.rb