Skip to content

Reposition asset path build #347

New issue

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

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

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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/react/rails/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Railtie < ::Rails::Railtie

end

config.before_initialize do |app|
initializer "react_rails.set_variant", after: :engines_blank_point, group: :all do |app|
asset_variant = React::Rails::AssetVariant.new({
variant: app.config.react.variant,
addons: app.config.react.addons,
Expand Down
1 change: 1 addition & 0 deletions test/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Application < Rails::Application
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.react.variant = :production
config.react.addons = false

config.assets.enabled = true
end
Expand Down
2 changes: 2 additions & 0 deletions test/dummy/config/initializers/react.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Override setting set in application.rb
Rails.application.config.react.addons = true
4 changes: 2 additions & 2 deletions test/react_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class ReactTest < ActionDispatch::IntegrationTest
end
end

test "the development version is loaded" do
test "the development version with addons is loaded" do
asset = Rails.application.assets.find_asset('react')
assert asset.pathname.to_s.end_with?('development/react.js')
assert asset.pathname.to_s.end_with?('development-with-addons/react.js')
end
end