-
Notifications
You must be signed in to change notification settings - Fork 552
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
Eliminating unused classes #127
Comments
Thanks for your answer @joeybaker If I add My situation is that I'm using purecss in my project but I want to hide that fact from my React components. They should not know which css framework I'm using so that I can change and tweak the css. Therefore, I have a lot of css modules with compose-only classes like this: /* Button.css */
.button {
composes: pure-button from global;
} That produces a lot of empty and unused real classes. |
Hmm… why wouldn't you want to have |
@joeybaker I want to have |
Ah, I see. That's totally fair. |
+1 |
Is there any progress on this? |
I've been doing that in |
I agree, we have many levels of composition in our themed components and we end up with 5 or 6 empty classes and empty classes on the element attributes. The minimize flag on css loader DOES remove them from the CSS, but they are not removed from the HTML when its rendered. It would make our DOM considerably smaller to have these unused classes removed. Is there any way to achieve this? |
A lot of empty class names rendered in html, anybody PR ? |
Is it not possible to use |
5 years old, has anyone come up with a solution? |
@felixsanz Yes, I have proposed a solution (css-modules/postcss-modules-scope#32). It's currently being reviewed by @alexander-akait. If it's approved, then an option should also be added to |
Yep, need to find time on review 😞 still in my TODO |
Any update on this? |
Let's say I have the following code:
When I run the code with style loader and css loader, the output is:
and the style element added into DOM is:
The class roundedAndRedBorder is used here only to compose the two other classes. Therefore, I think we should not have the class test__roundedAndRedBorder in the output. What do you think?
The text was updated successfully, but these errors were encountered: