3 ms·
The author claims OOCSS is a great philosophy when writing CSS, but then goes on to complain about a tool that is specifically written with OOCSS in mind. It wo
by huckfinnaafb 15y ago
The author claims OOCSS is a great philosophy when writing CSS, but then goes on to complain about a tool that is specifically written with OOCSS in mind. It would be a much simpler thing to write "CSS Lint checks for good OOCSS habits, but can't be trusted to verify non-OOCSS, so be wary."
>Don’t use IDs in selectors
>They are the fastest way a browser can select a given element.
Yes and no. Using an ID to get an element via JS is fast, undeniably so. But the difference in selecting by ID vs. Class in CSS is so minuscule it's hardly worth mentioning. If you're styling an element based on an ID used by JS, congratulations, you've just needlessly coupled JS and CSS.
>Performance at the cost of everything else. Performance as the altar at which all the other benefits of CSS are sacrificed.
Be more dramatic. OOCSS's primary benefit is to minimize maintenance and reduce CSS filesize. File transfer is the second biggest culprit of page load times. I hardly see optimizing CSS as a tertiary goal, and speeding up CSS does not sacrifice other things if done properly.
>Utterly arbitrary. Use as many as you need to get whatever result you’re after. You’re the designer, you know what’s appropriate, and it has little to no impact on performance.
The issue here is that people who use font-size too much are likely simply not appreciating the cascade. That can be said for numerous other properties like float, font-family, padding, and margins.
That all being said, CSS Lint is extraordinarily opinionated. How could it be anything else? If you're looking for a syntax lint, check out W3C's Unicorn. If you're looking to discover a new philosophy for writing reusable, extendable, and optimized CSS, make sure you understand why exactly CSS Lint is throwing you a warning/error and take steps to improve your styles.