File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,8 @@ module React
22 module Rails
33 class Engine < ::Rails ::Engine
44 initializer "react_rails.setup_engine" , :group => :all do |app |
5- if app . assets . nil?
6- Sprockets . register_engine '.jsx' , React ::JSX ::Template
7- else
8- app . assets . register_engine '.jsx' , React ::JSX ::Template
9- end
5+ sprockets_env = app . assets || Sprockets # Sprockets 3.x expects this in a different place
6+ sprockets_env . register_engine ( ".jsx" , React ::JSX ::Template )
107 end
118 end
129 end
Original file line number Diff line number Diff line change @@ -38,11 +38,8 @@ class Railtie < ::Rails::Railtie
3838 addons : app . config . react . addons ,
3939 } )
4040
41- if app . assets . nil?
42- app . config . assets . version = [ app . config . assets . version , "react-#{ asset_variant . react_build } " , ] . compact . join ( '-' )
43- else
44- app . assets . version = [ app . assets . version , "react-#{ asset_variant . react_build } " , ] . compact . join ( '-' )
45- end
41+ sprockets_env = app . assets || app . config . assets # sprockets-rails 3.x attaches this at a different config
42+ sprockets_env . version = [ sprockets_env . version , "react-#{ asset_variant . react_build } " , ] . compact . join ( '-' )
4643
4744 end
4845
You can’t perform that action at this time.
0 commit comments