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

Fix name conflicts by using slugs for routing in isolated mode #998

Closed

Conversation

jonatansberg
Copy link

Hello @sapegin and all of you!
We're using styleguidist as a part of a big client project, and alost immediately ran in to problems with that the components all live in a global namespace, mentioned in #325, #919 and other places.

Requiring the specific components that you need is a bit ugly but works to solve naming conflicts in the examples. I'd like to take a stab at fixing this as well at some point, but we had a more critical problem with the routing.

When using styleguidist with the pagePerSection option set to true the routing use the section or component name instead of it's slug as a path/hash, meaning sections with conflicting names are completely unreachable.

Since the slugs we're already in place to (I assume) handle this very problem when you don't use the pagePerSection option using them here as well seemed like a reasonable solution.

The slug generation could possibly be improved further by prefixing child-section slugs with the parent section, allowing for for more meaningful and stable urls (e.g. button/button and toolbar/button instead of button and `button-1) but this might be a breaking change for some.

@stale
Copy link

stale bot commented Dec 28, 2018

😴 This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week without any further activity. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 28, 2018
@stale stale bot closed this Jan 4, 2019
@wachunga
Copy link
Contributor

It would be good to fix these conflicts. Or at least warn when they happen...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants