Just had a thought recently that I think might align / help CSS modules: Should CSS modules drop empty classes? # Motivation Some of my stylesheets are strictly related to specific components. These stylesheets only compose from our design system. ``` .container { composes: field field-rounded field-editable from 'styleguide/field.css'; } ``` # Problem The component gets 4 classes applied but one of them is useless. ``` <input class="foo-container-123 styleguide-field-123 styleguide-field-rounded-123 styleguide-field-editable-123" /> ``` Out of convenience, it would be neat to avoid exporting a class name which has no rules. Just wanted to share this thought and get feedback.
Activity
roblevintennis commentedon Oct 27, 2017
I'm actually seeing similar type of thing but when I use composes:
So for every composed class, I get an additional empty class. I see from the readme you guys mention:
But it's a bit surprising to see all the extra classes as an application developer and initially made me think I was doing something wrong.
This was similarly for composes like the following classes:
shepmaster commentedon Mar 30, 2018
Seems to be a duplicate of #127.
bitttttten commentedon Jul 28, 2018
You can use
minimize: truein the css-loader options which will remove the class from the CSS, but it does not remove the class from the DOM.feat: add option to omit locals with empty declaration blocks
feat: add option to omit locals with empty declaration blocks
feat: add option to omit locals with empty declaration blocks
tamer-flaconi commentedon Jan 24, 2023
any updates on this?