Skip to content

Commit

Permalink
workaround for react server render error
Browse files Browse the repository at this point in the history
  • Loading branch information
koffeinfrei committed Jun 20, 2016
1 parent 8fc3348 commit 9c07d28
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
//= require bootstrap-material-design
//= require react
//= require react_ujs
//= require auto_save
//= require components
//= require trumbowyg/dist/trumbowyg
//= require momentjs/moment
//= require bootbox/bootbox
//= require_tree .

$(function () {
$.material.init();
Expand Down
2 changes: 2 additions & 0 deletions app/assets/javascripts/server_rendering.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//= require react-server
//= require components
5 changes: 5 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,9 @@

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

# React
config.react.server_renderer_options = {
files: %w(server_rendering.js)
}
end
3 changes: 3 additions & 0 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
Rails.application.config.assets.precompile += bower_precompile_paths

# Workaround for react server side rendering
Rails.application.config.assets.precompile += %w(server_rendering.js)

0 comments on commit 9c07d28

Please sign in to comment.