react_on_rails 11.1.7 → 12.0.0.pre.beta.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +320 -0
- data/.eslintignore +2 -1
- data/.eslintrc +30 -2
- data/.github/FUNDING.yml +1 -0
- data/.gitignore +3 -1
- data/.prettierignore +10 -0
- data/.prettierrc +23 -0
- data/.release-it.json +3 -0
- data/.rubocop.yml +37 -11
- data/.travis.yml +10 -20
- data/CHANGELOG.md +86 -3
- data/CONTRIBUTING.md +61 -80
- data/Gemfile +3 -5
- data/{COMM-LICENSE → REACT-ON-RAILS-PRO-LICENSE} +6 -9
- data/README.md +117 -68
- data/Rakefile +0 -7
- data/SUMMARY.md +12 -12
- data/book.json +5 -5
- data/docs/additional-reading/asset-pipeline.md +8 -16
- data/docs/additional-reading/images.md +1 -1
- data/docs/additional-reading/rails_view_rendering_from_inline_javascript.md +2 -1
- data/docs/additional-reading/react-helmet.md +30 -10
- data/docs/additional-reading/react-router.md +52 -75
- data/docs/additional-reading/server-rendering-tips.md +12 -7
- data/docs/additional-reading/upgrade-webpacker-v3-to-v4.md +10 -0
- data/docs/api/javascript-api.md +3 -3
- data/docs/api/redux-store-api.md +4 -2
- data/docs/api/view-helpers-api.md +17 -14
- data/docs/basics/configuration.md +64 -61
- data/docs/basics/deployment.md +1 -2
- data/docs/basics/generator-details.md +1 -1
- data/docs/basics/i18n.md +44 -22
- data/docs/basics/installation-into-an-existing-rails-app.md +2 -2
- data/docs/basics/minitest-configuration.md +31 -0
- data/docs/basics/react-server-rendering.md +3 -1
- data/docs/basics/recommended-project-structure.md +24 -1
- data/docs/basics/{generator-functions-and-railscontext.md → render-functions-and-railscontext.md} +59 -21
- data/docs/basics/rspec-configuration.md +2 -2
- data/docs/basics/upgrading-react-on-rails.md +61 -3
- data/docs/basics/webpack-configuration.md +26 -1
- data/docs/contributor-info/errors-with-hooks.md +45 -0
- data/docs/contributor-info/pull-requests.md +44 -0
- data/docs/misc/doctrine.md +1 -1
- data/docs/{misc-pending → outdated}/code-splitting.md +13 -9
- data/docs/{additional-reading → outdated}/heroku-deployment.md +0 -6
- data/docs/{basics → outdated}/how-react-on-rails-works.md +2 -2
- data/docs/{misc-pending → outdated}/manual-installation-overview.md +5 -5
- data/docs/{additional-reading → outdated}/rails-assets-relative-paths.md +3 -3
- data/docs/{misc-pending → outdated}/rails-assets.md +4 -7
- data/docs/{misc → outdated}/rails3.md +0 -0
- data/docs/testimonials/hvmn.md +25 -0
- data/docs/testimonials/resortpass.md +13 -0
- data/docs/testimonials/testimonials.md +28 -0
- data/docs/tutorial.md +157 -25
- data/jest.config.js +4 -0
- data/lib/generators/react_on_rails/dev_tests_generator.rb +2 -1
- data/lib/generators/react_on_rails/generator_helper.rb +4 -6
- data/lib/generators/react_on_rails/install_generator.rb +2 -0
- data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +9 -8
- data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +4 -8
- data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.js +1 -3
- data/lib/react_on_rails.rb +4 -1
- data/lib/react_on_rails/configuration.rb +15 -23
- data/lib/react_on_rails/error.rb +2 -0
- data/lib/react_on_rails/git_utils.rb +2 -0
- data/lib/react_on_rails/helper.rb +110 -159
- data/lib/react_on_rails/json_output.rb +1 -1
- data/lib/react_on_rails/json_parse_error.rb +2 -0
- data/lib/react_on_rails/locales/base.rb +142 -0
- data/lib/react_on_rails/locales/to_js.rb +37 -0
- data/lib/react_on_rails/locales/to_json.rb +27 -0
- data/lib/react_on_rails/prerender_error.rb +11 -15
- data/lib/react_on_rails/react_component/render_options.rb +4 -0
- data/lib/react_on_rails/server_rendering_js_code.rb +42 -0
- data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +85 -60
- data/lib/react_on_rails/test_helper/ensure_assets_compiled.rb +7 -8
- data/lib/react_on_rails/utils.rb +19 -20
- data/lib/react_on_rails/version.rb +1 -1
- data/lib/react_on_rails/version_checker.rb +5 -1
- data/lib/react_on_rails/webpacker_utils.rb +21 -2
- data/lib/tasks/assets.rake +5 -45
- data/lib/tasks/locale.rake +8 -2
- data/package-scripts.yml +49 -0
- data/package.json +41 -31
- data/rakelib/dummy_apps.rake +1 -9
- data/rakelib/example_type.rb +3 -1
- data/rakelib/examples.rake +3 -0
- data/rakelib/lint.rake +2 -7
- data/rakelib/node_package.rake +2 -2
- data/rakelib/release.rake +3 -2
- data/rakelib/run_rspec.rake +5 -18
- data/react_on_rails.gemspec +3 -5
- data/tsconfig.json +14 -0
- data/webpackConfigLoader.js +5 -4
- data/yarn.lock +7042 -2327
- metadata +40 -57
- data/Gemfile.rails32 +0 -74
- data/docs/additional-reading/babel.md +0 -5
- data/docs/additional-reading/hot-reloading-rails-development.md +0 -57
- data/docs/api/ruby-api-hot-reload-view-helpers.md +0 -44
- data/docs/testimonials.md +0 -11
- data/lib/react_on_rails/assets_precompile.rb +0 -150
- data/lib/react_on_rails/locales_to_js.rb +0 -136
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 12.0.0.pre.beta.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Gordon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '2'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '2'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: coveralls
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,20 +220,6 @@ dependencies:
|
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
|
-
- !ruby/object:Gem::Dependency
|
224
|
-
name: pry-stack_explorer
|
225
|
-
requirement: !ruby/object:Gem::Requirement
|
226
|
-
requirements:
|
227
|
-
- - ">="
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '0'
|
230
|
-
type: :development
|
231
|
-
prerelease: false
|
232
|
-
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
requirements:
|
234
|
-
- - ">="
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
version: '0'
|
237
223
|
- !ruby/object:Gem::Dependency
|
238
224
|
name: pry-state
|
239
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,20 +234,6 @@ dependencies:
|
|
248
234
|
- - ">="
|
249
235
|
- !ruby/object:Gem::Version
|
250
236
|
version: '0'
|
251
|
-
- !ruby/object:Gem::Dependency
|
252
|
-
name: pry-toys
|
253
|
-
requirement: !ruby/object:Gem::Requirement
|
254
|
-
requirements:
|
255
|
-
- - ">="
|
256
|
-
- !ruby/object:Gem::Version
|
257
|
-
version: '0'
|
258
|
-
type: :development
|
259
|
-
prerelease: false
|
260
|
-
version_requirements: !ruby/object:Gem::Requirement
|
261
|
-
requirements:
|
262
|
-
- - ">="
|
263
|
-
- !ruby/object:Gem::Version
|
264
|
-
version: '0'
|
265
237
|
- !ruby/object:Gem::Dependency
|
266
238
|
name: rails
|
267
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -308,16 +280,16 @@ dependencies:
|
|
308
280
|
name: rubocop
|
309
281
|
requirement: !ruby/object:Gem::Requirement
|
310
282
|
requirements:
|
311
|
-
- -
|
283
|
+
- - '='
|
312
284
|
- !ruby/object:Gem::Version
|
313
|
-
version: 0.
|
285
|
+
version: 0.85.0
|
314
286
|
type: :development
|
315
287
|
prerelease: false
|
316
288
|
version_requirements: !ruby/object:Gem::Requirement
|
317
289
|
requirements:
|
318
|
-
- -
|
290
|
+
- - '='
|
319
291
|
- !ruby/object:Gem::Version
|
320
|
-
version: 0.
|
292
|
+
version: 0.85.0
|
321
293
|
description: See README.md
|
322
294
|
email:
|
323
295
|
- justin@shakacode.com
|
@@ -326,26 +298,30 @@ extensions: []
|
|
326
298
|
extra_rdoc_files: []
|
327
299
|
files:
|
328
300
|
- ".bookignore"
|
301
|
+
- ".circleci/config.yml"
|
329
302
|
- ".coveralls.yml"
|
330
303
|
- ".dockerignore"
|
331
304
|
- ".eslintignore"
|
332
305
|
- ".eslintrc"
|
306
|
+
- ".github/FUNDING.yml"
|
333
307
|
- ".gitignore"
|
334
308
|
- ".npmignore"
|
309
|
+
- ".prettierignore"
|
310
|
+
- ".prettierrc"
|
311
|
+
- ".release-it.json"
|
335
312
|
- ".rspec"
|
336
313
|
- ".rubocop.yml"
|
337
314
|
- ".scss-lint.yml"
|
338
315
|
- ".travis.yml"
|
339
316
|
- CHANGELOG.md
|
340
|
-
- COMM-LICENSE
|
341
317
|
- CONTRIBUTING.md
|
342
318
|
- Dockerfile_tests
|
343
319
|
- Gemfile
|
344
|
-
- Gemfile.rails32
|
345
320
|
- KUDOS.md
|
346
321
|
- LICENSE.md
|
347
322
|
- NEWS.md
|
348
323
|
- PROJECTS.md
|
324
|
+
- REACT-ON-RAILS-PRO-LICENSE
|
349
325
|
- README.md
|
350
326
|
- Rakefile
|
351
327
|
- SUMMARY.md
|
@@ -354,17 +330,13 @@ files:
|
|
354
330
|
- docker-compose.yml
|
355
331
|
- docs/additional-reading/angular-js-integration-migration.md
|
356
332
|
- docs/additional-reading/asset-pipeline.md
|
357
|
-
- docs/additional-reading/babel.md
|
358
333
|
- docs/additional-reading/capistrano-deployment.md
|
359
334
|
- docs/additional-reading/convert-rails-5-api-only-app.md
|
360
335
|
- docs/additional-reading/credits.md
|
361
336
|
- docs/additional-reading/elastic-beanstalk.md
|
362
337
|
- docs/additional-reading/foreman-issues.md
|
363
|
-
- docs/additional-reading/heroku-deployment.md
|
364
|
-
- docs/additional-reading/hot-reloading-rails-development.md
|
365
338
|
- docs/additional-reading/images.md
|
366
339
|
- docs/additional-reading/node-dependencies-and-npm.md
|
367
|
-
- docs/additional-reading/rails-assets-relative-paths.md
|
368
340
|
- docs/additional-reading/rails-engine-integration.md
|
369
341
|
- docs/additional-reading/rails_view_rendering_from_inline_javascript.md
|
370
342
|
- docs/additional-reading/react-and-redux.md
|
@@ -375,40 +347,48 @@ files:
|
|
375
347
|
- docs/additional-reading/troubleshooting-when-using-webpacker.md
|
376
348
|
- docs/additional-reading/turbolinks.md
|
377
349
|
- docs/additional-reading/updating-dependencies.md
|
350
|
+
- docs/additional-reading/upgrade-webpacker-v3-to-v4.md
|
378
351
|
- docs/additional-reading/webpack-dev-server.md
|
379
352
|
- docs/additional-reading/webpack-v1-notes.md
|
380
353
|
- docs/additional-reading/webpack.md
|
381
354
|
- docs/api/javascript-api.md
|
382
355
|
- docs/api/redux-store-api.md
|
383
|
-
- docs/api/ruby-api-hot-reload-view-helpers.md
|
384
356
|
- docs/api/view-helpers-api.md
|
385
357
|
- docs/articles.md
|
386
358
|
- docs/basics/client-vs-server-rendering.md
|
387
359
|
- docs/basics/configuration.md
|
388
360
|
- docs/basics/deployment.md
|
389
361
|
- docs/basics/generator-details.md
|
390
|
-
- docs/basics/generator-functions-and-railscontext.md
|
391
|
-
- docs/basics/how-react-on-rails-works.md
|
392
362
|
- docs/basics/i18n.md
|
393
363
|
- docs/basics/installation-into-an-existing-rails-app.md
|
394
364
|
- docs/basics/migrating-from-react-rails.md
|
365
|
+
- docs/basics/minitest-configuration.md
|
395
366
|
- docs/basics/react-server-rendering.md
|
396
367
|
- docs/basics/recommended-project-structure.md
|
368
|
+
- docs/basics/render-functions-and-railscontext.md
|
397
369
|
- docs/basics/rspec-configuration.md
|
398
370
|
- docs/basics/upgrading-react-on-rails.md
|
399
371
|
- docs/basics/webpack-configuration.md
|
400
372
|
- docs/coding-style/style.md
|
373
|
+
- docs/contributor-info/errors-with-hooks.md
|
401
374
|
- docs/contributor-info/generator-testing.md
|
402
375
|
- docs/contributor-info/linters.md
|
376
|
+
- docs/contributor-info/pull-requests.md
|
403
377
|
- docs/contributor-info/releasing.md
|
404
|
-
- docs/misc-pending/code-splitting.md
|
405
|
-
- docs/misc-pending/manual-installation-overview.md
|
406
|
-
- docs/misc-pending/rails-assets.md
|
407
378
|
- docs/misc/code_of_conduct.md
|
408
379
|
- docs/misc/doctrine.md
|
409
|
-
- docs/
|
410
|
-
- docs/
|
380
|
+
- docs/outdated/code-splitting.md
|
381
|
+
- docs/outdated/heroku-deployment.md
|
382
|
+
- docs/outdated/how-react-on-rails-works.md
|
383
|
+
- docs/outdated/manual-installation-overview.md
|
384
|
+
- docs/outdated/rails-assets-relative-paths.md
|
385
|
+
- docs/outdated/rails-assets.md
|
386
|
+
- docs/outdated/rails3.md
|
387
|
+
- docs/testimonials/hvmn.md
|
388
|
+
- docs/testimonials/resortpass.md
|
389
|
+
- docs/testimonials/testimonials.md
|
411
390
|
- docs/tutorial.md
|
391
|
+
- jest.config.js
|
412
392
|
- lib/generators/USAGE
|
413
393
|
- lib/generators/react_on_rails/base_generator.rb
|
414
394
|
- lib/generators/react_on_rails/dev_tests_generator.rb
|
@@ -440,7 +420,6 @@ files:
|
|
440
420
|
- lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/startup/HelloWorldApp.jsx
|
441
421
|
- lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.js
|
442
422
|
- lib/react_on_rails.rb
|
443
|
-
- lib/react_on_rails/assets_precompile.rb
|
444
423
|
- lib/react_on_rails/configuration.rb
|
445
424
|
- lib/react_on_rails/controller.rb
|
446
425
|
- lib/react_on_rails/engine.rb
|
@@ -449,9 +428,12 @@ files:
|
|
449
428
|
- lib/react_on_rails/helper.rb
|
450
429
|
- lib/react_on_rails/json_output.rb
|
451
430
|
- lib/react_on_rails/json_parse_error.rb
|
452
|
-
- lib/react_on_rails/
|
431
|
+
- lib/react_on_rails/locales/base.rb
|
432
|
+
- lib/react_on_rails/locales/to_js.rb
|
433
|
+
- lib/react_on_rails/locales/to_json.rb
|
453
434
|
- lib/react_on_rails/prerender_error.rb
|
454
435
|
- lib/react_on_rails/react_component/render_options.rb
|
436
|
+
- lib/react_on_rails/server_rendering_js_code.rb
|
455
437
|
- lib/react_on_rails/server_rendering_pool.rb
|
456
438
|
- lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb
|
457
439
|
- lib/react_on_rails/test_helper.rb
|
@@ -465,6 +447,7 @@ files:
|
|
465
447
|
- lib/react_on_rails/webpacker_utils.rb
|
466
448
|
- lib/tasks/assets.rake
|
467
449
|
- lib/tasks/locale.rake
|
450
|
+
- package-scripts.yml
|
468
451
|
- package.json
|
469
452
|
- rakelib/docker.rake
|
470
453
|
- rakelib/dummy_apps.rake
|
@@ -482,6 +465,7 @@ files:
|
|
482
465
|
- script/release
|
483
466
|
- script/setup
|
484
467
|
- script/test
|
468
|
+
- tsconfig.json
|
485
469
|
- webpackConfigLoader.js
|
486
470
|
- yarn.lock
|
487
471
|
homepage: https://github.com/shakacode/react_on_rails
|
@@ -501,15 +485,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
501
485
|
requirements:
|
502
486
|
- - ">="
|
503
487
|
- !ruby/object:Gem::Version
|
504
|
-
version: 2.
|
488
|
+
version: 2.5.0
|
505
489
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
506
490
|
requirements:
|
507
|
-
- - "
|
491
|
+
- - ">"
|
508
492
|
- !ruby/object:Gem::Version
|
509
|
-
version:
|
493
|
+
version: 1.3.1
|
510
494
|
requirements: []
|
511
|
-
|
512
|
-
rubygems_version: 2.7.7
|
495
|
+
rubygems_version: 3.0.8
|
513
496
|
signing_key:
|
514
497
|
specification_version: 4
|
515
498
|
summary: Rails with react server rendering with webpack.
|
data/Gemfile.rails32
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
eval_gemfile File.expand_path("../react_on_rails.gemspec", __FILE__)
|
6
|
-
|
7
|
-
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
8
|
-
gem "rails", "~> 3.2"
|
9
|
-
# Use sqlite3 as the database for Active Record
|
10
|
-
gem "sqlite3"
|
11
|
-
# Use SCSS for stylesheets
|
12
|
-
gem "sass-rails"
|
13
|
-
# Use Uglifier as compressor for JavaScript assets
|
14
|
-
gem "uglifier"
|
15
|
-
# Use CoffeeScript for .coffee assets and views
|
16
|
-
gem "coffee-rails"
|
17
|
-
|
18
|
-
# Use jquery as the JavaScript library
|
19
|
-
gem "jquery-rails"
|
20
|
-
|
21
|
-
gem "puma"
|
22
|
-
|
23
|
-
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
24
|
-
gem "jbuilder"
|
25
|
-
# bundle exec rake doc:rails generates the API under doc/api.
|
26
|
-
gem "sdoc", group: :doc
|
27
|
-
|
28
|
-
# Use ActiveModel has_secure_password
|
29
|
-
# gem 'bcrypt', '~> 3.1.7'
|
30
|
-
|
31
|
-
# Use Unicorn as the app server
|
32
|
-
# gem 'unicorn'
|
33
|
-
|
34
|
-
# Use Capistrano for deployment
|
35
|
-
# gem 'capistrano-rails', group: :development
|
36
|
-
|
37
|
-
gem "mini_racer"
|
38
|
-
gem "connection_pool"
|
39
|
-
gem "rainbow"
|
40
|
-
gem "addressable"
|
41
|
-
gem "execjs"
|
42
|
-
|
43
|
-
group :development, :test do
|
44
|
-
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
45
|
-
gem "awesome_print"
|
46
|
-
gem "listen"
|
47
|
-
gem "pry"
|
48
|
-
gem "pry-byebug"
|
49
|
-
gem "pry-doc"
|
50
|
-
gem "pry-rails"
|
51
|
-
gem "pry-rescue"
|
52
|
-
gem "pry-stack_explorer"
|
53
|
-
gem "rubocop", require: false
|
54
|
-
gem "ruby-lint", require: false
|
55
|
-
gem "scss_lint", require: false
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
group :test do
|
60
|
-
gem "capybara"
|
61
|
-
gem "capybara-screenshot"
|
62
|
-
gem "coveralls", require: false
|
63
|
-
# install trouble with updated
|
64
|
-
# gem "capybara-webkit"
|
65
|
-
gem "chromedriver-helper"
|
66
|
-
gem "generator_spec"
|
67
|
-
gem "launchy"
|
68
|
-
gem "poltergeist"
|
69
|
-
gem "rspec-rails"
|
70
|
-
gem "rspec-retry"
|
71
|
-
gem "selenium-webdriver"
|
72
|
-
gem 'test-unit', '~> 3.0'
|
73
|
-
gem "equivalent-xml", github: "mbklein/equivalent-xml"
|
74
|
-
end
|
@@ -1,5 +0,0 @@
|
|
1
|
-
# Babel
|
2
|
-
|
3
|
-
As of React on Rails 2.0, we recommend Babel 6 and at least node version 5.5. If you want to stick with Babel 5 for a bit, see [Issue #238](https://github.com/shakacode/react_on_rails/issues/238).
|
4
|
-
|
5
|
-
We recommend that you take a look at https://github.com/shakacode/react-webpack-rails-tutorial and follow the recipe there. We will try to keep that simple example updated.
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# Live Reloading vs. Hot Reloading (aka HMR)
|
2
|
-
|
3
|
-
The use of the [webpack-dev-server](https://webpack.js.org/configuration/dev-server/) provides "Live Reloading" by default. The difference between live and hot reloading is that live reloading will act similarly to hitting refresh in the browser. Hot reloading will attempt to preserve the state of any props.
|
4
|
-
|
5
|
-
See the Webpack document [Hot Module Replacement](https://webpack.js.org/concepts/hot-module-replacement/) for more details on the concepts of live vs. hot reloading.
|
6
|
-
|
7
|
-
The remainder of this document discusses HMR.
|
8
|
-
|
9
|
-
# Using the Webpacker Webpack setup
|
10
|
-
|
11
|
-
If you are using the default Webpacker setup of running the dev server with `bin/webpack-dev-server`, see the [Webpacker Webpack Dev Server discussion of HMR](https://github.com/rails/webpacker/blob/master/docs/webpack-dev-server.md#hot-module-replacement).
|
12
|
-
|
13
|
-
|
14
|
-
# Hot Reloading of Assets For Rails Development
|
15
|
-
|
16
|
-
_Note, this document is not yet updated for React on Rails v8+. See [PR #865](https://github.com/shakacode/react_on_rails/pull/865) for a detailed example of doing hot reloading using V8+ with Webpack v2. Any volunteers to update this page? See [#772](https://github.com/shakacode/react_on_rails/issues/772) and [#361](https://github.com/shakacode/react-webpack-rails-tutorial/issues/361)._
|
17
|
-
|
18
|
-
------
|
19
|
-
|
20
|
-
This document outlines the steps to setup your React On Rails Environment so that you can experience the pleasure of hot reloading of JavaScript and Sass during your Rails development work. See [Issue 332](https://github.com/shakacode/react_on_rails/issues/332) for troubleshooting. There are 3 examples of this setup:
|
21
|
-
|
22
|
-
1. [minimal demo here](https://github.com/retroalgic/react-on-rails-hot-minimal): The most simple and updated hot reloading setup.
|
23
|
-
1. [spec/dummy](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy): Simpler setup used for integration testing this gem.
|
24
|
-
1. [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/). Full featured setup using Twitter bootstrap.
|
25
|
-
|
26
|
-
## Help Wanted
|
27
|
-
|
28
|
-
This doc might be outdated. PRs welcome!
|
29
|
-
|
30
|
-
## High Level Strategy
|
31
|
-
|
32
|
-
We'll use a Webpack Dev server on port 3500 to provide the assets to Rails, rather than the asset pipeline, and only during development mode. This is configured via the `Procfile.hot`.
|
33
|
-
|
34
|
-
`Procfile.static` provides an alternative that uses "static" assets, similar to a production deployment.
|
35
|
-
|
36
|
-
## Places to Configure (Files to Examine)
|
37
|
-
|
38
|
-
1. See the Webpack config files. Note, these examples are now setup for using [CSS Modules](https://github.com/css-modules/css-modules).
|
39
|
-
1. [client/webpack.client.base.config.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/webpack.client.base.config.js): Common configuration for hot or static assets.
|
40
|
-
1. [client/webpack.client.rails.hot.config.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/webpack.client.rails.hot.config.js): Setup for hot loading, using react-transform-hmr.
|
41
|
-
1. [client/webpack.client.rails.build.config.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/webpack.client.rails.build.config.js): Setup for static loading, as is done in a production deployment.
|
42
|
-
1. [app/views/layouts/application.html.erb](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/app/views/layouts/application.html.erb): Uses the view helpers `env_stylesheet_link_tag` and `env_javascript_include_tag` which will either do the hot reloading or the static loading.
|
43
|
-
1. See the Procfiles: [Procfile.hot](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/Procfile.hot) and [Procfile.static](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/Procfile.static). These:
|
44
|
-
1. Start the webpack processes, depending on the mode or HOT or not.
|
45
|
-
2. Start the rails server, setting an ENV value of REACT_ON_RAILS_ENV to HOT if we're hot loading or else setting this to blank.
|
46
|
-
1. Configure the file Rails asset pipeline files:
|
47
|
-
1. [app/assets/javascripts/application_static.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/app/assets/javascripts/application_static.js)
|
48
|
-
1. [app/assets/stylesheets/application_non_webpack.scss](https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/app/assets/stylesheets/application_non_webpack.scss)
|
49
|
-
1. Copy the [client/server-rails-hot.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/server-rails-hot.js) to the your client directory.
|
50
|
-
1. Copy the scripts in the top level and client level `package.json` files:
|
51
|
-
1. Top Level: [package.json](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/package.json)
|
52
|
-
1. Client Level: [package.json](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/package.json)
|
53
|
-
|
54
|
-
|
55
|
-
## Code Snippets
|
56
|
-
Please refer to the examples linked above in `spec/dummy` as these code samples might be out of date.
|
57
|
-
|
@@ -1,44 +0,0 @@
|
|
1
|
-
## NOTE: These helpers are NOT needed if using webpacker
|
2
|
-
|
3
|
-
## Hot Reloading View Helpers
|
4
|
-
The `env_javascript_include_tag` and `env_stylesheet_link_tag` support the usage of a webpack dev server for providing the JS and CSS assets during development mode. See the [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/) for a working example.
|
5
|
-
|
6
|
-
The key options are `static` and `hot` which specify what you want for static vs. hot. Both of these params are optional, and support either a single value, or an array.
|
7
|
-
|
8
|
-
static vs. hot is picked based on whether `ENV["REACT_ON_RAILS_ENV"] == "HOT"`
|
9
|
-
|
10
|
-
```erb
|
11
|
-
<%= env_stylesheet_link_tag(static: 'application_static',
|
12
|
-
hot: 'application_non_webpack',
|
13
|
-
media: 'all',
|
14
|
-
'data-turbolinks-track' => true) %>
|
15
|
-
|
16
|
-
<!-- These do not use turbolinks, so no data-turbolinks-track -->
|
17
|
-
<!-- This is to load the hot assets. -->
|
18
|
-
|
19
|
-
<!-- Note, you can have multiple files here. It's an array. -->
|
20
|
-
<%= env_javascript_include_tag(hot: ['http://localhost:3500/hello-world-bundle.js]') %>
|
21
|
-
|
22
|
-
<!-- These do use turbolinks -->
|
23
|
-
<%= env_javascript_include_tag(static: 'application_static',
|
24
|
-
hot: 'application_non_webpack',
|
25
|
-
'data-turbolinks-track' => true) %>
|
26
|
-
```
|
27
|
-
|
28
|
-
See application.html.erb for usage example and [application.html.erb](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/app%2Fviews%2Flayouts%2Fapplication.html.erb)
|
29
|
-
|
30
|
-
Helper to set CSS and JS assets depending on if we want static or "hot", which means from the Webpack dev server.
|
31
|
-
|
32
|
-
In this example, `application_non_webpack` is simply a CSS asset pipeline file which includes styles not placed in the webpack build. The same can be said for `application_non_webpack` for JS files. Note, the suffix is not used in the helper calls.
|
33
|
-
|
34
|
-
We don't need styles from the webpack build, as those will come via the JavaScript include tags.
|
35
|
-
|
36
|
-
The key options are `static` and `hot` which specify what you want for static vs. hot. Both of
|
37
|
-
these params are optional, and support either a single value, or an array.
|
38
|
-
|
39
|
-
```erb
|
40
|
-
<%= env_stylesheet_link_tag(static: 'application_static',
|
41
|
-
hot: 'application_non_webpack',
|
42
|
-
media: 'all',
|
43
|
-
'data-turbolinks-track' => true) %>
|
44
|
-
```
|
data/docs/testimonials.md
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# Testimonials
|
2
|
-
|
3
|
-
From Joel Hooks, Co-Founder, Chief Nerd at [egghead.io](https://egghead.io/), January 30, 2017:
|
4
|
-
|
5
|
-
![2017-01-30_11-33-59](https://cloud.githubusercontent.com/assets/1118459/22443635/b3549fb4-e6e3-11e6-8ea2-6f589dc93ed3.png)
|
6
|
-
|
7
|
-
From Kyle Maune of Cooper Aerial, May 4, 2018
|
8
|
-
|
9
|
-
![image](https://user-images.githubusercontent.com/1118459/40891236-9b0b406e-671d-11e8-80ee-c026dbd1d5a2.png)
|
10
|
-
|
11
|
-
For more testimonials, see [Live Projects](PROJECTS.md) and [Kudos](KUDOS.md).
|