CHAPTER 1 Modern CSS Architecture and Front-End Development
The client doesn’t care if you managed to avoid using any classes and
wrote no extraneous markup, but if using two classes and an extra div
makes your job easier, and makes the site easier to maintain, you should
opt for the extra code every time. There is no use making your life more
difficult because you think that avoiding an extra few characters of HTML
is the right way to go. Be kind to yourself and your team.
KeeP The RighT PeoPle haPPY
By keeping all of these three stakeholders in mind, we can begin to make
more informed decisions about how we write our front-end code: users
don’t care if we’ve written semantic classes; clients don’t care how many
IDs we’ve used; and only we care about how nice our code is to work with.
In reality, developers are the only people who really care about code.
Write it for yourself, but write it to be fast (for the users) and robust (for
the client). Everyone benefits in some way from good code, but users and
clients only benefit from its results. Developers benefit directly from the
quality of the actual code itself (sensible naming conventions, plenty of
comments, and so on).
Takeaway: The code we write has to serve more people than just ourselves,
and in different ways. We need to write fast, robust code for clients and
users, and maintainable, sane code for ourselves.
Some Misconceptions About CSS
There are still some greatly misunderstood aspects of CSS (and HTML)
that — at a fundamental level — will affect the way you approach build-
ing websites. These misconceptions need acknowledging and fixing. In
so doing, we will free ourselves from years-old dogma and feel a lot more
liberated and empowered to build bigger, faster, more powerful front-ends.
I honestly believe it was realizing, understanding and subsequently
ditching these misconceptions that took me from being able to merely
write CSS to being able to scale CSS for massive websites.