DEV Community

Discussion on: Harry Potter and the Order of CSS

Collapse
 
myfonj profile image
Michal Čaplygin

Another strong ABCSS advocate is Jens Meiert: meiert.com/en/blog/on-declaration-... . He is AFaIK author of the original Google HTML & CSS guide.

Collapse
 
thekashey profile image
Anton Korzunov

Yet again, and quite unfortunately, I haven't found any "strong" opinions.

But I appended this article with a conclusion, where I did say - sorting is a poor man solution - it does not solves the main problem. ANY sorting does not the solving the problem.

What does:

  • locality - keeping similar things together
  • separation of concerns - splitting one big problem(hard to load into your brain) into smaller ones. This is alpha and omega for almost any CS problem.

Just think about CSS from a "JS" prospective. What do we do to keep our code manageable - we do fight Cyclomatic complexity, and KISS.

  • Alpha sorting is making it even worse. Are you sorting your functions? CSS selectors? Alpha sorting is breaking coherence and locality,
  • Group sorting is not a solution for the problem - it's still a WALL OF TEXT.
  • Grouping (just add a blank line between groups) - magically - do the job.