-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[system] Shorten class names in production #27932
[system] Shorten class names in production #27932
Conversation
@mnajdova what do you think about this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, sorry I must have missed the PR, thanks for mentioning me
I have tested with styled-components, it works too. I'm moving forward on the simple basis that it's closer to how emotion and styled-components behave. It might help developers to feel more "at home", e.g. they could wonder if they correctly set NODE_ENV = 'production' if they keep seeing the dev class names in production. |
@oliviertassinari @mnajdova - Hey! Thanks a lot for the library! I see how this improves the length of the inlined styles. In particular, this change broke customization of custom components using selectors like This was working previously in production as this check was not in place, but no longer does. Is this no longer supported? and/or is there a new way to do this or workaround? Would you be interested in supporting this feature parity for MUI components and custom components? Maybe through enabling the global class names. |
@maxtechera do you have a reproduction of the behavior so we have context? There are too many unknown for me to really understand the problem you are trying to solve. If I had to guess, it seems that you are creating custom components with the styled() method, and using the component name, slot name options. Did you consider adding the class names on the element directly? |
Testing this idea #27838 (comment) out.
It doesn't make a major difference but it seems harmless and consistent with how emotion & styled-components handles debuggable class names.
I have tried https://www.webpagetest.org/ but the variance was too high to see a real difference. So I guess, it's more around, do we want the long class names in production at the expense of an inlined CSS a bit larger?