From 63aebf487fa6e106a48837e7e18a2b697ad48bc5 Mon Sep 17 00:00:00 2001 From: Ciprian Redinciuc Date: Mon, 14 Sep 2020 19:54:42 +0300 Subject: [PATCH 1/2] Extend documentation for using Stimulus within sidecar directories --- CHANGELOG.md | 4 ++++ README.md | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ba030873..29d30ffd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master +* Extend documentation for using Stimulus within sidecar directories. + + *Ciprian Redinciuc* + * Fix uninitialized constant error from `with_collection` when `eager_load` is disabled. *Josh Gross* diff --git a/README.md b/README.md index fdf85f26c..c140bf997 100644 --- a/README.md +++ b/README.md @@ -992,6 +992,30 @@ application.load( This enables the creation of files such as `app/components/widget_controller.js`, where the controller identifier matches the `data-controller` attribute in the component's HTML template. +If you place your Stimulus controller inside a sidecar directory, please be aware that when referencing your Stimulus controller [each forward slash in a namespaced controller file’s path becomes two dashes in its identifier]( +https://stimulusjs.org/handbook/installing#controller-filenames-map-to-identifiers). + +```console +app/components +├── ... +├── example +| ├── component.rb +| ├── component.css +| ├── component.html.erb +| └── component_controller.js +├── ... + +``` + +In the example above, the `component_controller.js` Stimulus identifier becomes: `example--component`: + +```erb +
+ + +
+``` + ## Frequently Asked Questions ### Can I use other templating languages besides ERB? From 026eea0610c88ab762d0d2eb0688275892007d28 Mon Sep 17 00:00:00 2001 From: Joel Hawksley Date: Mon, 14 Sep 2020 13:15:13 -0600 Subject: [PATCH 2/2] Apply suggestions from code review --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c140bf997..6eae10508 100644 --- a/README.md +++ b/README.md @@ -992,8 +992,8 @@ application.load( This enables the creation of files such as `app/components/widget_controller.js`, where the controller identifier matches the `data-controller` attribute in the component's HTML template. -If you place your Stimulus controller inside a sidecar directory, please be aware that when referencing your Stimulus controller [each forward slash in a namespaced controller file’s path becomes two dashes in its identifier]( -https://stimulusjs.org/handbook/installing#controller-filenames-map-to-identifiers). +When placing a Stimulus controller inside a sidecar directory, be aware that when referencing the controller [each forward slash in a namespaced controller file’s path becomes two dashes in its identifier]( +https://stimulusjs.org/handbook/installing#controller-filenames-map-to-identifiers): ```console app/components @@ -1004,10 +1004,9 @@ app/components | ├── component.html.erb | └── component_controller.js ├── ... - ``` -In the example above, the `component_controller.js` Stimulus identifier becomes: `example--component`: +`component_controller.js`'s Stimulus identifier becomes: `example--component`: ```erb