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

Add 'nestedMode' param #11

Closed
wants to merge 1 commit into from
Closed

Conversation

serhiihiba
Copy link

@serhiihiba serhiihiba commented Aug 16, 2023

Hi, @ElMassimo after our discussion #10 I found the problem.
It was because my app uses the convention of reduced controller identifiers that's why stimulus-vite-helper didn't work for me.
In this PR I suggest a simple additional parameter {nestedMode: true} for registerControllers function which allows reducing controller identifiers when the last part of their name is duplicated because of the sidecar folders structure

//├ components
//│ └ ui/
//│   └ button_component/
//│     └ button_component_controller.js

registerControllers(application, controllers);
// default
//=> ui--button-component--button-component

registerControllers(application, controllers, { nestedMode: true });
// reduced
//=> ui--button-component

@serhiihiba
Copy link
Author

@ElMassimo can you approve or decline this, please?

@ElMassimo
Copy link
Owner

ElMassimo commented Feb 12, 2024

Hi Serhii!

I'd like to keep this library minimal and general purpose.

For teams using different conventions than usual, the source code here can be used as a starting point to implement their own, as you have done here 👍

@ElMassimo ElMassimo closed this Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants