Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple controller root folders #45

Merged
merged 2 commits into from
Oct 20, 2023

Conversation

marcoroth
Copy link
Owner

@marcoroth marcoroth commented Oct 20, 2023

This pull request adds support for handling multiple controller root folders. This is useful when a project has more than one folder where it defines Stimulus controllers.

Previously any controller which wasn't located in app/javascript/controllers/ wouldn't be provided with the right identifier. For example a controller in app/packs/controllers/test_controller.js would have been provided as app--packs--controllers--test which obviously isn't right. This is now fixed and will be correctly provided as test.

The stimulus-parser now automatically detects these root folders and doesn't rely on the hard-coded app/javascript/controllers/ folder.

Additionally the stimulus.controller.create Quick-Fix action now also accounts for multiple root folders. If the project has more than one root it will prompt you to choose a root folder location:
CleanShot 2023-10-20 at 08 12 40

This might fix #26.

@marcoroth marcoroth added enhancement New feature or request feature Issue that implements a new feature. labels Oct 20, 2023
@marcoroth marcoroth changed the title Support for multiple controller roots Support for multiple controller root folders Oct 20, 2023
@marcoroth marcoroth merged commit 0c38bf8 into main Oct 20, 2023
@marcoroth marcoroth deleted the support-for-multiple-controller-roots branch October 20, 2023 06:30
@marcoroth marcoroth mentioned this pull request Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature Issue that implements a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for custom JS namespaces
1 participant