Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix of missing initializer at sprockets. #371

Merged
merged 2 commits into from
Dec 2, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/i18n/js/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module I18n
module JS
class Engine < ::Rails::Engine
initializer "i18n-js.register_preprocessor", :after => "sprockets.environment" do
initializer "i18n-js.register_preprocessor", after: :engines_blank_point, before: :finisher_hook do
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, little bit more details:

  1. Here is where sprockets are attached with Rails. There is no 'sprockets.environment' mentioned.
    https://github.com/rails/sprockets-rails/blob/master/lib/sprockets/railtie.rb
  2. Finisher hook is the place which should be used as border.
    http://guides.rubyonrails.org/configuring.html#initializers

https://github.com/rails/sprockets-rails/blob/master/lib/sprockets/railtie.rb#L160

I.e. we should define preprocessors and such before sprockets finalizes configuration. In our case it was using cached environment.

next unless JS::Dependencies.using_asset_pipeline?
next unless JS::Dependencies.sprockets_supports_register_preprocessor?

Expand Down