heybourn / headwind

An opinionated Tailwind CSS class sorter built for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=heybourn.headwind
MIT License
1.38k stars 46 forks source link

Remove duplicate class types #54

Open ottosson opened 4 years ago

ottosson commented 4 years ago

Is your feature request related to a problem? Please describe. Not really. Might improve bundle size if unused classes are removed.

Describe the solution you'd like Similarly to removing exact duplicate classes Headwind should be able to remove duplicate class types. If I add two color classes, like text-red-400 and text-red-600, 400 is redundant and will be overridden by 600 which means 400 could be removed.

praveenperera commented 4 years ago

Thats an interesting idea, how would you do it?

Even if it doesn't automatically replace it maybe we can get it to emit a warning saying "there are redundant classes"?

hacknug commented 4 years ago

Even if it doesn't automatically replace it maybe we can get it to emit a warning saying "there are redundant classes"?

I like this better since I feel most of the conflicts could lead to unexpected resolutions. Of course the applied styles would be the same but imho it's better to let users know and let them deal with that on their own like most linters do. Maybe we could add a fix option to automatically handle those like eslint or stylelint do? Should this feature become its own stylelint plugin then?

kissu commented 3 years ago

Would be perfect to have it into stylelint, agreed ! 🙏🏻

hacknug commented 3 years ago

Core's tailwindcss-intellisense has been taking care of this for a while so I guess we can close? No need to duplicate functionality unless required by some kind of incompatible tooling.