File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed
lib/generators/react_on_rails Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,9 @@ def add_hello_world_route
2424 def create_react_directories
2525 # Create auto-registration directory structure for non-Redux components only
2626 # Redux components handle their own directory structure
27- unless options . redux?
28- empty_directory ( "app/javascript/src/HelloWorld/ror_components" )
29- end
27+ return if options . redux?
28+
29+ empty_directory ( "app/javascript/src/HelloWorld/ror_components" )
3030 end
3131
3232 def copy_base_files
@@ -46,13 +46,11 @@ def copy_base_files
4646 def copy_js_bundle_files
4747 base_path = "base/base/"
4848 base_files = %w[ app/javascript/packs/server-bundle.js ]
49-
49+
5050 # Only copy HelloWorld.module.css for non-Redux components
5151 # Redux components handle their own CSS files
52- unless options . redux?
53- base_files << "app/javascript/src/HelloWorld/HelloWorld.module.css"
54- end
55-
52+ base_files << "app/javascript/src/HelloWorld/HelloWorld.module.css" unless options . redux?
53+
5654 base_files . each { |file | copy_file ( "#{ base_path } #{ file } " , file ) }
5755 end
5856
Original file line number Diff line number Diff line change @@ -11,15 +11,15 @@ class ReactWithReduxGenerator < Rails::Generators::Base
1111 def create_redux_directories
1212 # Create auto-registration directory structure for Redux
1313 empty_directory ( "app/javascript/src/HelloWorldApp/ror_components" )
14-
14+
1515 # Create Redux support directories within the component directory
1616 dirs = %w[ actions constants containers reducers store ]
1717 dirs . each { |name | empty_directory ( "app/javascript/src/HelloWorldApp/#{ name } " ) }
1818 end
1919
2020 def copy_base_files
2121 base_js_path = "redux/base"
22-
22+
2323 # Copy Redux-connected component to auto-registration structure
2424 copy_file ( "#{ base_js_path } /app/javascript/bundles/HelloWorld/startup/HelloWorldApp.client.jsx" ,
2525 "app/javascript/src/HelloWorldApp/ror_components/HelloWorldApp.client.jsx" )
You can’t perform that action at this time.
0 commit comments