This content originally appeared on CSS-Tricks and was authored by Chris Coyier
Eric, again not mincin’ no words with blog post titles. This is me:
The most common CSS declaration organization technique I come across is none whatsoever.
Almost none, anyway. I tend to group them by whatever dumps out of my brain as I’m writing them, which usually ends up with somewhat logical groups, like box model stuff grouped together and color stuff grouped together. It just… hasn’t mattered to me. But that is strongly influenced by typically working on small teams or alone. Eric recommends the alphabetical approach because:
[…] it imposes a baseline sense of structure across a team. This ask is usually enough, especially if it means cleaning up what’s come before.
And his (probably bigger) point is that the imparted structure helps legitimize CSS in a world where CSS skills are undervalued. Not going to argue against that, but I would argue that hand-alphabetizing CSS on an existing project is very likely not a good use of time. Worse, it might break stuff if done blindly, which is why Prettier punted on it. If you and your team agree this is a good idea, I’d find a way to get this into an on-save function in your code editor and make it a pre-commit hook. Alphabetizing is a task for computers to do and the output can be verified as you are authoring.
Direct Link to Article — Permalink
The post Organize your CSS declarations alphabetically appeared first on CSS-Tricks. You can support CSS-Tricks by being an MVP Supporter.
This content originally appeared on CSS-Tricks and was authored by Chris Coyier
Chris Coyier | Sciencx (2021-07-22T22:33:29+00:00) Organize your CSS declarations alphabetically. Retrieved from https://www.scien.cx/2021/07/22/organize-your-css-declarations-alphabetically/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.