Skip to content

Utilise component name in generated class name #3648

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

Closed
mattpilott opened this issue Oct 1, 2019 · 3 comments
Closed

Utilise component name in generated class name #3648

mattpilott opened this issue Oct 1, 2019 · 3 comments

Comments

@mattpilott
Copy link
Contributor

I use the BEM style naming despite svelte making class names unique with something like svelte-1wpmmks, I do this so things are clearly grouped.

Describe the solution you'd like
However I would find it more useful if the generated class included the component name such as buttton-svelte-1wpmmks for example.

How important is this feature to you?
I think about this on every project and although it isn't life changing it would allow for tidier css without losing the additional readability that class grouping gives you.

Thanks for reading!

@antony
Copy link
Member

antony commented Oct 1, 2019

This would add a not-insignificant amount of bytes to the CSS and HTML.

There was a proposal once about having control over the generated class names (#570).

What I would suggest is that the default stays as is svelte-* and there is a hook to allow changing that generated name, which would have access to a context object which might contain the component name along with some other information.

That way you could generate whatever names were useful to you.

@mattpilott
Copy link
Contributor Author

That would be all I need to be honest

@Conduitry
Copy link
Member

Duplicate of #2822 and #2900, and what #570 has been left open for.

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

No branches or pull requests

3 participants