diff --git a/.gitignore b/.gitignore index 5fb66c9..0f6db75 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ # Ignore master key for decrypting credentials and more. /config/master.key + +/node_modules +/public/packs \ No newline at end of file diff --git a/Gemfile b/Gemfile index 3c61f52..2f2abee 100644 --- a/Gemfile +++ b/Gemfile @@ -68,3 +68,4 @@ gem "money" gem 'acts-as-taggable-on' gem "rubytree" +gem 'react-rails' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 969a923..8166041 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,6 +77,10 @@ GEM tzinfo (~> 2.0) acts-as-taggable-on (10.0.0) activerecord (>= 6.1, < 7.2) + babel-source (5.8.35) + babel-transpiler (0.7.0) + babel-source (>= 4.0, < 6) + execjs (~> 2.0) base64 (0.2.0) bigdecimal (3.1.8) bindex (0.8.1) @@ -94,6 +98,7 @@ GEM diff-lcs (1.5.1) drb (2.2.1) erubi (1.13.0) + execjs (2.9.1) factory_bot (6.4.6) activesupport (>= 5.0.0) factory_bot_rails (6.4.3) @@ -204,6 +209,12 @@ GEM rake (13.2.1) rdoc (6.7.0) psych (>= 4.0.0) + react-rails (3.2.1) + babel-transpiler (>= 0.7.0) + connection_pool + execjs + railties (>= 3.2) + tilt redis (5.2.0) redis-client (>= 0.22.0) redis-client (0.22.2) @@ -240,6 +251,7 @@ GEM railties (>= 6.0.0) stringio (3.1.1) thor (1.3.1) + tilt (2.4.0) timeout (0.4.1) turbo-rails (2.0.6) actionpack (>= 6.0.0) @@ -279,6 +291,7 @@ DEPENDENCIES pry puma (>= 5.0) rails (~> 7.1.3, >= 7.1.3.2) + react-rails redis (>= 4.0.1) rspec-rails (~> 6.1.0) rubytree diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..16767c5 --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,3 @@ +//= require react +//= require react_ujs +//= require components diff --git a/app/assets/javascripts/components.js b/app/assets/javascripts/components.js new file mode 100644 index 0000000..9ce7a4f --- /dev/null +++ b/app/assets/javascripts/components.js @@ -0,0 +1 @@ +//= require_tree ./components diff --git a/app/assets/javascripts/components/.keep b/app/assets/javascripts/components/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/server_rendering.js b/app/assets/javascripts/server_rendering.js new file mode 100644 index 0000000..aa54d4e --- /dev/null +++ b/app/assets/javascripts/server_rendering.js @@ -0,0 +1,6 @@ +//= require react-server +//= require react_ujs +//= require ./components +// +// By default, this file is loaded for server-side rendering. +// It should require your components and any dependencies. diff --git a/config/initializers/react_server_rendering.rb b/config/initializers/react_server_rendering.rb new file mode 100644 index 0000000..6690108 --- /dev/null +++ b/config/initializers/react_server_rendering.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +# To render React components in production, precompile the server rendering manifest: +Rails.application.config.assets.precompile += ["server_rendering.js"]