react_on_rails 11.0.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- 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 +39 -11
- data/.travis.yml +11 -22
- data/CHANGELOG.md +235 -6
- data/CONTRIBUTING.md +64 -84
- data/Gemfile +3 -5
- data/KUDOS.md +4 -1
- data/{docs/LICENSE.md → LICENSE.md} +1 -1
- data/PROJECTS.md +7 -1
- data/REACT-ON-RAILS-PRO-LICENSE +95 -0
- data/README.md +233 -630
- data/Rakefile +1 -5
- data/SUMMARY.md +42 -29
- data/book.json +5 -5
- data/docs/additional-reading/asset-pipeline.md +8 -16
- data/docs/additional-reading/convert-rails-5-api-only-app.md +19 -0
- data/docs/additional-reading/credits.md +10 -0
- data/docs/additional-reading/images.md +1 -1
- data/docs/additional-reading/rails-engine-integration.md +7 -0
- 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 +14 -11
- data/docs/additional-reading/upgrade-webpacker-v3-to-v4.md +10 -0
- data/docs/additional-reading/webpack.md +2 -2
- data/docs/api/javascript-api.md +24 -4
- data/docs/api/redux-store-api.md +102 -0
- data/docs/api/view-helpers-api.md +133 -0
- data/docs/articles.md +20 -0
- data/docs/basics/client-vs-server-rendering.md +23 -0
- data/docs/basics/configuration.md +145 -61
- data/docs/basics/deployment.md +4 -0
- data/docs/basics/{generator.md → generator-details.md} +5 -8
- data/docs/basics/heroku-deployment.md +24 -0
- data/docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md +49 -0
- data/docs/basics/i18n.md +45 -23
- data/docs/basics/installation-into-an-existing-rails-app.md +59 -0
- data/docs/basics/minitest-configuration.md +31 -0
- data/docs/basics/react-server-rendering.md +29 -0
- data/docs/{additional-reading → basics}/recommended-project-structure.md +38 -10
- data/docs/basics/render-functions-and-railscontext.md +205 -0
- data/docs/basics/rspec-configuration.md +73 -0
- data/docs/basics/upgrading-react-on-rails.md +75 -4
- data/docs/basics/webpack-configuration.md +50 -0
- data/docs/contributor-info/errors-with-hooks.md +45 -0
- data/docs/contributor-info/pull-requests.md +44 -0
- data/docs/misc/doctrine.md +2 -2
- data/docs/{additional-reading → outdated}/code-splitting.md +19 -9
- data/docs/outdated/how-react-on-rails-works.md +44 -0
- data/docs/{basics/installation-overview.md → outdated/manual-installation-overview.md} +8 -13
- data/docs/{additional-reading → outdated}/rails-assets-relative-paths.md +3 -3
- data/docs/{additional-reading → outdated}/rails-assets.md +5 -13
- 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 +182 -44
- data/jest.config.js +4 -0
- data/lib/generators/USAGE +1 -1
- data/lib/generators/react_on_rails/base_generator.rb +2 -2
- data/lib/generators/react_on_rails/dev_tests_generator.rb +3 -2
- 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/Procfile.dev +3 -1
- data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-hmr +26 -0
- data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +20 -40
- data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +4 -1
- 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/configuration.rb +175 -102
- data/lib/react_on_rails/error.rb +2 -0
- data/lib/react_on_rails/git_utils.rb +2 -0
- data/lib/react_on_rails/{react_on_rails_helper.rb → helper.rb} +201 -225
- data/lib/react_on_rails/json_output.rb +1 -1
- data/lib/react_on_rails/json_parse_error.rb +28 -0
- data/lib/react_on_rails/locales/base.rb +150 -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 +56 -18
- data/lib/react_on_rails/react_component/render_options.rb +98 -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 +139 -106
- data/lib/react_on_rails/server_rendering_pool.rb +4 -16
- data/lib/react_on_rails/test_helper/ensure_assets_compiled.rb +7 -8
- data/lib/react_on_rails/test_helper/webpack_assets_compiler.rb +17 -0
- data/lib/react_on_rails/test_helper/webpack_assets_status_checker.rb +10 -6
- data/lib/react_on_rails/test_helper.rb +18 -7
- data/lib/react_on_rails/utils.rb +66 -26
- data/lib/react_on_rails/version.rb +1 -1
- data/lib/react_on_rails/version_checker.rb +5 -1
- data/lib/react_on_rails/version_syntax_converter.rb +14 -12
- data/lib/react_on_rails/webpacker_utils.rb +44 -10
- data/lib/react_on_rails.rb +8 -3
- data/lib/tasks/assets.rake +33 -46
- data/lib/tasks/locale.rake +4 -2
- data/package-scripts.yml +49 -0
- data/package.json +49 -40
- 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 +4 -8
- data/rakelib/run_rspec.rake +5 -18
- data/react_on_rails.gemspec +5 -6
- data/tsconfig.json +14 -0
- data/webpackConfigLoader.js +5 -4
- data/yarn.lock +7645 -1821
- metadata +71 -61
- data/Gemfile.rails32 +0 -74
- data/docs/additional-reading/babel.md +0 -5
- data/docs/additional-reading/caching-and-performance.md +0 -4
- data/docs/additional-reading/heroku-deployment.md +0 -92
- data/docs/additional-reading/hot-reloading-rails-development.md +0 -57
- data/docs/additional-reading/node-server-rendering.md +0 -5
- data/docs/additional-reading/rspec-configuration.md +0 -56
- data/docs/api/ruby-api-hot-reload-view-helpers.md +0 -44
- data/docs/api/ruby-api.md +0 -8
- data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-server +0 -12
- data/lib/react_on_rails/assets_precompile.rb +0 -150
- data/lib/react_on_rails/locales_to_js.rb +0 -134
- data/lib/react_on_rails/react_component/options.rb +0 -64
- /data/docs/{misc → outdated}/rails3.md +0 -0
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
|
|
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-07-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -72,14 +72,28 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
75
|
+
version: '3.0'
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
82
|
+
version: '3.0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: webpacker
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '4.0'
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '4.0'
|
|
83
97
|
- !ruby/object:Gem::Dependency
|
|
84
98
|
name: awesome_print
|
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -100,14 +114,14 @@ dependencies:
|
|
|
100
114
|
requirements:
|
|
101
115
|
- - "~>"
|
|
102
116
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
117
|
+
version: '2'
|
|
104
118
|
type: :development
|
|
105
119
|
prerelease: false
|
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
121
|
requirements:
|
|
108
122
|
- - "~>"
|
|
109
123
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '
|
|
124
|
+
version: '2'
|
|
111
125
|
- !ruby/object:Gem::Dependency
|
|
112
126
|
name: coveralls
|
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -220,20 +234,6 @@ dependencies:
|
|
|
220
234
|
- - ">="
|
|
221
235
|
- !ruby/object:Gem::Version
|
|
222
236
|
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
237
|
- !ruby/object:Gem::Dependency
|
|
238
238
|
name: pry-state
|
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -248,20 +248,6 @@ dependencies:
|
|
|
248
248
|
- - ">="
|
|
249
249
|
- !ruby/object:Gem::Version
|
|
250
250
|
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
251
|
- !ruby/object:Gem::Dependency
|
|
266
252
|
name: rails
|
|
267
253
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -310,14 +296,14 @@ dependencies:
|
|
|
310
296
|
requirements:
|
|
311
297
|
- - '='
|
|
312
298
|
- !ruby/object:Gem::Version
|
|
313
|
-
version: 0.
|
|
299
|
+
version: 0.85.0
|
|
314
300
|
type: :development
|
|
315
301
|
prerelease: false
|
|
316
302
|
version_requirements: !ruby/object:Gem::Requirement
|
|
317
303
|
requirements:
|
|
318
304
|
- - '='
|
|
319
305
|
- !ruby/object:Gem::Version
|
|
320
|
-
version: 0.
|
|
306
|
+
version: 0.85.0
|
|
321
307
|
description: See README.md
|
|
322
308
|
email:
|
|
323
309
|
- justin@shakacode.com
|
|
@@ -326,12 +312,17 @@ extensions: []
|
|
|
326
312
|
extra_rdoc_files: []
|
|
327
313
|
files:
|
|
328
314
|
- ".bookignore"
|
|
315
|
+
- ".circleci/config.yml"
|
|
329
316
|
- ".coveralls.yml"
|
|
330
317
|
- ".dockerignore"
|
|
331
318
|
- ".eslintignore"
|
|
332
319
|
- ".eslintrc"
|
|
320
|
+
- ".github/FUNDING.yml"
|
|
333
321
|
- ".gitignore"
|
|
334
322
|
- ".npmignore"
|
|
323
|
+
- ".prettierignore"
|
|
324
|
+
- ".prettierrc"
|
|
325
|
+
- ".release-it.json"
|
|
335
326
|
- ".rspec"
|
|
336
327
|
- ".rubocop.yml"
|
|
337
328
|
- ".scss-lint.yml"
|
|
@@ -340,64 +331,79 @@ files:
|
|
|
340
331
|
- CONTRIBUTING.md
|
|
341
332
|
- Dockerfile_tests
|
|
342
333
|
- Gemfile
|
|
343
|
-
- Gemfile.rails32
|
|
344
334
|
- KUDOS.md
|
|
335
|
+
- LICENSE.md
|
|
345
336
|
- NEWS.md
|
|
346
337
|
- PROJECTS.md
|
|
338
|
+
- REACT-ON-RAILS-PRO-LICENSE
|
|
347
339
|
- README.md
|
|
348
340
|
- Rakefile
|
|
349
341
|
- SUMMARY.md
|
|
350
342
|
- app/helpers/react_on_rails_helper.rb
|
|
351
343
|
- book.json
|
|
352
344
|
- docker-compose.yml
|
|
353
|
-
- docs/LICENSE.md
|
|
354
345
|
- docs/additional-reading/angular-js-integration-migration.md
|
|
355
346
|
- docs/additional-reading/asset-pipeline.md
|
|
356
|
-
- docs/additional-reading/babel.md
|
|
357
|
-
- docs/additional-reading/caching-and-performance.md
|
|
358
347
|
- docs/additional-reading/capistrano-deployment.md
|
|
359
|
-
- docs/additional-reading/
|
|
348
|
+
- docs/additional-reading/convert-rails-5-api-only-app.md
|
|
349
|
+
- docs/additional-reading/credits.md
|
|
360
350
|
- docs/additional-reading/elastic-beanstalk.md
|
|
361
351
|
- docs/additional-reading/foreman-issues.md
|
|
362
|
-
- docs/additional-reading/heroku-deployment.md
|
|
363
|
-
- docs/additional-reading/hot-reloading-rails-development.md
|
|
364
352
|
- docs/additional-reading/images.md
|
|
365
353
|
- docs/additional-reading/node-dependencies-and-npm.md
|
|
366
|
-
- docs/additional-reading/node-server-rendering.md
|
|
367
|
-
- docs/additional-reading/rails-assets-relative-paths.md
|
|
368
|
-
- docs/additional-reading/rails-assets.md
|
|
369
354
|
- docs/additional-reading/rails-engine-integration.md
|
|
370
355
|
- docs/additional-reading/rails_view_rendering_from_inline_javascript.md
|
|
371
356
|
- docs/additional-reading/react-and-redux.md
|
|
372
357
|
- docs/additional-reading/react-helmet.md
|
|
373
358
|
- docs/additional-reading/react-router.md
|
|
374
|
-
- docs/additional-reading/recommended-project-structure.md
|
|
375
|
-
- docs/additional-reading/rspec-configuration.md
|
|
376
359
|
- docs/additional-reading/server-rendering-tips.md
|
|
377
360
|
- docs/additional-reading/tips.md
|
|
378
361
|
- docs/additional-reading/troubleshooting-when-using-webpacker.md
|
|
379
362
|
- docs/additional-reading/turbolinks.md
|
|
380
363
|
- docs/additional-reading/updating-dependencies.md
|
|
364
|
+
- docs/additional-reading/upgrade-webpacker-v3-to-v4.md
|
|
381
365
|
- docs/additional-reading/webpack-dev-server.md
|
|
382
366
|
- docs/additional-reading/webpack-v1-notes.md
|
|
383
367
|
- docs/additional-reading/webpack.md
|
|
384
368
|
- docs/api/javascript-api.md
|
|
385
|
-
- docs/api/
|
|
386
|
-
- docs/api/
|
|
369
|
+
- docs/api/redux-store-api.md
|
|
370
|
+
- docs/api/view-helpers-api.md
|
|
371
|
+
- docs/articles.md
|
|
372
|
+
- docs/basics/client-vs-server-rendering.md
|
|
387
373
|
- docs/basics/configuration.md
|
|
388
|
-
- docs/basics/
|
|
374
|
+
- docs/basics/deployment.md
|
|
375
|
+
- docs/basics/generator-details.md
|
|
376
|
+
- docs/basics/heroku-deployment.md
|
|
377
|
+
- docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md
|
|
389
378
|
- docs/basics/i18n.md
|
|
390
|
-
- docs/basics/installation-
|
|
379
|
+
- docs/basics/installation-into-an-existing-rails-app.md
|
|
391
380
|
- docs/basics/migrating-from-react-rails.md
|
|
381
|
+
- docs/basics/minitest-configuration.md
|
|
382
|
+
- docs/basics/react-server-rendering.md
|
|
383
|
+
- docs/basics/recommended-project-structure.md
|
|
384
|
+
- docs/basics/render-functions-and-railscontext.md
|
|
385
|
+
- docs/basics/rspec-configuration.md
|
|
392
386
|
- docs/basics/upgrading-react-on-rails.md
|
|
387
|
+
- docs/basics/webpack-configuration.md
|
|
393
388
|
- docs/coding-style/style.md
|
|
389
|
+
- docs/contributor-info/errors-with-hooks.md
|
|
394
390
|
- docs/contributor-info/generator-testing.md
|
|
395
391
|
- docs/contributor-info/linters.md
|
|
392
|
+
- docs/contributor-info/pull-requests.md
|
|
396
393
|
- docs/contributor-info/releasing.md
|
|
397
394
|
- docs/misc/code_of_conduct.md
|
|
398
395
|
- docs/misc/doctrine.md
|
|
399
|
-
- docs/
|
|
396
|
+
- docs/outdated/code-splitting.md
|
|
397
|
+
- docs/outdated/how-react-on-rails-works.md
|
|
398
|
+
- docs/outdated/manual-installation-overview.md
|
|
399
|
+
- docs/outdated/rails-assets-relative-paths.md
|
|
400
|
+
- docs/outdated/rails-assets.md
|
|
401
|
+
- docs/outdated/rails3.md
|
|
402
|
+
- docs/testimonials/hvmn.md
|
|
403
|
+
- docs/testimonials/resortpass.md
|
|
404
|
+
- docs/testimonials/testimonials.md
|
|
400
405
|
- docs/tutorial.md
|
|
406
|
+
- jest.config.js
|
|
401
407
|
- lib/generators/USAGE
|
|
402
408
|
- lib/generators/react_on_rails/base_generator.rb
|
|
403
409
|
- lib/generators/react_on_rails/dev_tests_generator.rb
|
|
@@ -408,7 +414,7 @@ files:
|
|
|
408
414
|
- lib/generators/react_on_rails/react_with_redux_generator.rb
|
|
409
415
|
- lib/generators/react_on_rails/templates/.eslintrc
|
|
410
416
|
- lib/generators/react_on_rails/templates/base/base/Procfile.dev
|
|
411
|
-
- lib/generators/react_on_rails/templates/base/base/Procfile.dev-
|
|
417
|
+
- lib/generators/react_on_rails/templates/base/base/Procfile.dev-hmr
|
|
412
418
|
- lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb
|
|
413
419
|
- lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx
|
|
414
420
|
- lib/generators/react_on_rails/templates/base/base/app/javascript/packs/registration.js.tt
|
|
@@ -429,17 +435,20 @@ files:
|
|
|
429
435
|
- lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/startup/HelloWorldApp.jsx
|
|
430
436
|
- lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.js
|
|
431
437
|
- lib/react_on_rails.rb
|
|
432
|
-
- lib/react_on_rails/assets_precompile.rb
|
|
433
438
|
- lib/react_on_rails/configuration.rb
|
|
434
439
|
- lib/react_on_rails/controller.rb
|
|
435
440
|
- lib/react_on_rails/engine.rb
|
|
436
441
|
- lib/react_on_rails/error.rb
|
|
437
442
|
- lib/react_on_rails/git_utils.rb
|
|
443
|
+
- lib/react_on_rails/helper.rb
|
|
438
444
|
- lib/react_on_rails/json_output.rb
|
|
439
|
-
- lib/react_on_rails/
|
|
445
|
+
- lib/react_on_rails/json_parse_error.rb
|
|
446
|
+
- lib/react_on_rails/locales/base.rb
|
|
447
|
+
- lib/react_on_rails/locales/to_js.rb
|
|
448
|
+
- lib/react_on_rails/locales/to_json.rb
|
|
440
449
|
- lib/react_on_rails/prerender_error.rb
|
|
441
|
-
- lib/react_on_rails/react_component/
|
|
442
|
-
- lib/react_on_rails/
|
|
450
|
+
- lib/react_on_rails/react_component/render_options.rb
|
|
451
|
+
- lib/react_on_rails/server_rendering_js_code.rb
|
|
443
452
|
- lib/react_on_rails/server_rendering_pool.rb
|
|
444
453
|
- lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb
|
|
445
454
|
- lib/react_on_rails/test_helper.rb
|
|
@@ -453,6 +462,7 @@ files:
|
|
|
453
462
|
- lib/react_on_rails/webpacker_utils.rb
|
|
454
463
|
- lib/tasks/assets.rake
|
|
455
464
|
- lib/tasks/locale.rake
|
|
465
|
+
- package-scripts.yml
|
|
456
466
|
- package.json
|
|
457
467
|
- rakelib/docker.rake
|
|
458
468
|
- rakelib/dummy_apps.rake
|
|
@@ -470,6 +480,7 @@ files:
|
|
|
470
480
|
- script/release
|
|
471
481
|
- script/setup
|
|
472
482
|
- script/test
|
|
483
|
+
- tsconfig.json
|
|
473
484
|
- webpackConfigLoader.js
|
|
474
485
|
- yarn.lock
|
|
475
486
|
homepage: https://github.com/shakacode/react_on_rails
|
|
@@ -489,15 +500,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
489
500
|
requirements:
|
|
490
501
|
- - ">="
|
|
491
502
|
- !ruby/object:Gem::Version
|
|
492
|
-
version: 2.
|
|
503
|
+
version: 2.5.0
|
|
493
504
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
494
505
|
requirements:
|
|
495
506
|
- - ">="
|
|
496
507
|
- !ruby/object:Gem::Version
|
|
497
508
|
version: '0'
|
|
498
509
|
requirements: []
|
|
499
|
-
|
|
500
|
-
rubygems_version: 2.6.14
|
|
510
|
+
rubygems_version: 3.0.8
|
|
501
511
|
signing_key:
|
|
502
512
|
specification_version: 4
|
|
503
513
|
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,92 +0,0 @@
|
|
|
1
|
-
# Heroku Deployment
|
|
2
|
-
The generator has created the necessary files and gems for deployment to Heroku. If you have installed manually, you will need to provide these files yourself:
|
|
3
|
-
|
|
4
|
-
+ `Procfile`: used by Heroku and Foreman to start the Puma server
|
|
5
|
-
+ `12factor` gem: required by Heroku if using a version before Rails 5 (see their [README](https://github.com/heroku/rails_12factor#rails-5) for more information if upgrading from a lower version)
|
|
6
|
-
+ `'puma'` gem: recommended Heroku webserver
|
|
7
|
-
+ `config/puma.rb`: Puma webserver config file
|
|
8
|
-
+ `/package.json`: Top level package.json which must contain `"scripts": { "postinstall": "cd client && npm install" }`
|
|
9
|
-
|
|
10
|
-
If you want to see an updated example deployed to Heroku, please visit the [github.com/shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial).
|
|
11
|
-
|
|
12
|
-
## More details on precompilation using webpack to create JavaScript assets
|
|
13
|
-
This is how the `assets:precompile` rake task gets modified by `react_on_rails`. You should be able to call `clear_prerequisites` and setup your own custom precompile if needed.
|
|
14
|
-
```ruby
|
|
15
|
-
# These tasks run as pre-requisites of assets:precompile.
|
|
16
|
-
# Note, it's not possible to refer to ReactOnRails configuration values at this point.
|
|
17
|
-
Rake::Task["assets:precompile"]
|
|
18
|
-
.clear_prerequisites
|
|
19
|
-
.enhance([:environment, "react_on_rails:assets:compile_environment"])
|
|
20
|
-
.enhance do
|
|
21
|
-
Rake::Task["react_on_rails:assets:symlink_non_digested_assets"].invoke
|
|
22
|
-
Rake::Task["react_on_rails:assets:delete_broken_symlinks"].invoke
|
|
23
|
-
end
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
For an example of how to do this, see the [dummy app](https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/lib/tasks/assets.rake).
|
|
27
|
-
|
|
28
|
-
## Caching Node Modules
|
|
29
|
-
By default Heroku will cache the root `node_modules` directory between deploys but since we're installing in `client/node_modules` you'll need to add the following line to the `package.json` in your root directory (otherwise you'll have to sit through a full `yarn` on each deploy):
|
|
30
|
-
|
|
31
|
-
```js
|
|
32
|
-
"cacheDirectories": [
|
|
33
|
-
"node_modules",
|
|
34
|
-
"client/node_modules"
|
|
35
|
-
],
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## How to Deploy
|
|
39
|
-
|
|
40
|
-
React on Rails requires both a ruby environment (for Rails) and a Node environment (for Webpack), so you will need to have Heroku use multiple buildpacks.
|
|
41
|
-
|
|
42
|
-
Assuming you have downloaded and installed the Heroku command-line utility and have initialized the app, you will need to tell Heroku to use both buildpacks via the command-line:
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
heroku buildpacks:set heroku/ruby
|
|
46
|
-
heroku buildpacks:add --index 1 heroku/nodejs
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
For more information, see [Using Multiple Buildpacks for an App](https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app)
|
|
50
|
-
|
|
51
|
-
## Fresh Rails Install
|
|
52
|
-
|
|
53
|
-
### Swap out sqlite for postgres by doing the following:
|
|
54
|
-
|
|
55
|
-
#### 1. Delete the line with `sqlite` and replace it with:
|
|
56
|
-
|
|
57
|
-
```ruby
|
|
58
|
-
gem 'pg'
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
#### 2. Replace your `database.yml` file with this (assuming your app name is "ror")
|
|
62
|
-
|
|
63
|
-
```yml
|
|
64
|
-
default: &default
|
|
65
|
-
adapter: postgresql
|
|
66
|
-
username:
|
|
67
|
-
password:
|
|
68
|
-
host: localhost
|
|
69
|
-
|
|
70
|
-
development:
|
|
71
|
-
<<: *default
|
|
72
|
-
database: ror_development
|
|
73
|
-
|
|
74
|
-
# Warning: The database defined as "test" will be erased and
|
|
75
|
-
# re-generated from your development database when you run "rake".
|
|
76
|
-
# Do not set this db to the same as development or production.
|
|
77
|
-
test:
|
|
78
|
-
<<: *default
|
|
79
|
-
database: ror_test
|
|
80
|
-
|
|
81
|
-
production:
|
|
82
|
-
<<: *default
|
|
83
|
-
database: ror_production
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Run:
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
bundle
|
|
90
|
-
bin/rake db:setup
|
|
91
|
-
bin/rake db:migrate
|
|
92
|
-
```
|
|
@@ -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,5 +0,0 @@
|
|
|
1
|
-
# Node.js for Server Rendering
|
|
2
|
-
|
|
3
|
-
Node.js can be used as the backend for server-side rendering instead of [execJS](https://github.com/rails/execjs). Before you try this, consider the tradeoff of extra complexity with your deployments versus *potential* performance gains. While often ExecJS with [mini_racer](https://github.com/discourse/mini_racer) is "fast enough", we've heard of other large websites using Node.js for better server rendering performance.
|
|
4
|
-
|
|
5
|
-
If you want to use a node server for server rendering, [get in touch](mailto:justin@shakacode.com). ShakaCode has built a premium Node rendering server for React on Rails.
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# RSpec Configuration
|
|
2
|
-
Because you will probably want to run RSpec tests that rely on compiled webpack assets (typically, your integration/feature specs where `js: true`), you will want to ensure you don't accidentally run tests on missing or stale webpack assets. If you did use stale Webpack assets, you will get invalid test results as your tests do not use the very latest JavaScript code.
|
|
3
|
-
|
|
4
|
-
ReactOnRails provides a helper method called `ReactOnRails::TestHelper.configure_rspec_to_compile_assets`. Call this method from inside of the `RSpec.configure` block in your `spec/rails_helper.rb` file, passing the config as an argument. See file [lib/react_on_rails/test_helper.rb](../../lib/react_on_rails/test_helper.rb) for more details. You can customize this to your particular needs by replacing any of the default components used by `ReactOnRails::TestHelper.configure_rspec_to_compile_assets`.
|
|
5
|
-
|
|
6
|
-
```ruby
|
|
7
|
-
RSpec.configure do |config|
|
|
8
|
-
ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
You can pass one or more RSpec metatags as an optional second parameter to this helper method if you want this helper to run on examples other than where `:js` or `:server_rendering` (those are the defaults). The helper will compile webpack files at most once per test run. The helper will not compile the webpack files unless they are out of date (stale). The helper is configurable in terms of what command is used to prepare the files.
|
|
12
|
-
|
|
13
|
-
If you are using Webpack to build CSS assets, you should do something like this to ensure that you assets are built for any specs under `specs/requests` or `specs/features`:
|
|
14
|
-
|
|
15
|
-
```ruby
|
|
16
|
-
ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config, :requires_webpack_assets)
|
|
17
|
-
|
|
18
|
-
# Because we're using some CSS Webpack files, we need to ensure the webpack files are generated
|
|
19
|
-
# for all feature specs. https://github.com/shakacode/react_on_rails/issues/792
|
|
20
|
-
config.define_derived_metadata(file_path: %r{spec/(features|requests)}) do |metadata|
|
|
21
|
-
metadata[:requires_webpack_assets] = true
|
|
22
|
-
end
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Please take note of the following:
|
|
26
|
-
- This utility uses your `build_test_command` to build the static generated files. This command **must not** include the `--watch` option. If you have different server and client bundle files, this command **must** create all the bundles. If you are using webpacker, the default value will come from the `config/webpacker.yml` value for the `public_output_path` and the `source_path`
|
|
27
|
-
- If you add an older file to your source files, that is already older than the produced output files, no new recompilation is done. The solution to this issue is to clear out your directory of webpack generated files when adding new source files that may have older dates. This is actually a common occurrence when you've built your test generated files and then you sync up your repository files.
|
|
28
|
-
|
|
29
|
-
- By default, the webpack processes look for the `app/assets/webpack` folders (configured as setting `webpack_generated_files` in the `config/react_on_rails.rb`. If this folder is missing, is empty, or contains files in the `config.webpack_generated_files` list with `mtime`s older than any of the files in your `client` folder, the helper will recompile your assets. You can override the location of these files inside of `config/initializers/react_on_rails.rb` by passing a filepath (relative to the root of the app) to the `generated_assets_dir` configuration option.
|
|
30
|
-
|
|
31
|
-
The following `config/react_on_rails.rb` settings **must** match your setup:
|
|
32
|
-
```ruby
|
|
33
|
-
# Directory where your generated assets go. All generated assets must go to the same directory.
|
|
34
|
-
# Configure this in your webpack config files. This relative to your Rails root directory.
|
|
35
|
-
# We recommend having different generated assets dirs per Rails env.
|
|
36
|
-
config.generated_assets_dir = File.join(%w[public webpack], Rails.env)
|
|
37
|
-
|
|
38
|
-
# Define the files we need to check for webpack compilation when running tests.
|
|
39
|
-
# Generally, the manifest.json is good enough for this check if using webpacker
|
|
40
|
-
config.webpack_generated_files = %w( hello-world-bundle.js )
|
|
41
|
-
|
|
42
|
-
# If you are using the ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
|
|
43
|
-
# with rspec then this controls what yarn command is run
|
|
44
|
-
# to automatically refresh your webpack assets on every test run.
|
|
45
|
-
config.build_test_command = "yarn run build:test"
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
If you want to speed up the re-compiling process so you don't wait to run your tests to build the files, you can run your test compilation with the "watch" flags.
|
|
49
|
-
|
|
50
|
-
[spec/dummy](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy) contains examples of how to set the proc files for this purpose.
|
|
51
|
-
|
|
52
|
-
If you want to use a testing framework other than RSpec, please submit let us know on the changes you need to do and we'll update the docs.
|
|
53
|
-
|
|
54
|
-

|
|
55
|
-
|
|
56
|
-

|
|
@@ -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/api/ruby-api.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# View Helpers
|
|
2
|
-
See the [app/helpers/react_on_rails_helper.rb](../../app/helpers/react_on_rails_helper.rb) source.
|
|
3
|
-
|
|
4
|
-
# Controller Helpers
|
|
5
|
-
See the [lib/react_on_rails/controller.rb](../../lib/react_on_rails/controller.rb) source.
|
|
6
|
-
|
|
7
|
-
# Utility Methods
|
|
8
|
-
See the [lib/react_on_rails/utils.rb](../../lib/react_on_rails/utils.rb) source.
|