⚡️ Leon Paternoster

/ Web

Using a sound CSS methodology (you might call it a framework) is a good thing

Smashing Magazine asked a common question in web development circles: Do you use a framework? Interestingly enough, I guess, about 60% of respondents do use a framework, and a whopping 42% of all respondents use Bootstrap (!)

Sara tweeted a popular response:

Never used any frameworks, never will. Writing CSS from scratch is one of the best pleasures of building front-ends in my opinion. ✨ @SaraSoueidan

I sort of agree with this (it’s an opinion about what Sara enjoys, after all, so who am I to disagree anyway – and she’s a far more talented developer than me, to boot), but I would question the efficiency of never using a set of repeatable classes for web projects (let’s steer clear of the term framework here).

Something like Bootstrap, no. I used Foundation for a while on the work website and did find I ended up either overwriting loads of CSS because it was so opinionated, or I had to write new CSS for the components it didn’t have. It was a mess.

However, I use Tachyons now (this statement always makes me think “I drink Yorkshire Tea now”), and couldn’t imagine building web pages without it. Not because it makes it easy for me to style a card or jumbotron predictably; no, Tachyons saves me time and brainache. It makes sketching ideas and developing them into finished UI really quick. It’s smaller, more efficient and faster than any CSS I could write because it’s nearly completely unopinionated and ruthlessly DRY and unspecific.

In fact, Tachyons (or any other modular or atomic framework) isn’t really a framework in the way Bootstrap is. There are no cards, jumbotrons or media components, just a terse class notation that maps more or less directly to CSS properties and values. I think of it more as a methodology, a way of implementing and managing HTML and CSS in a fast, sane way.

Which is why I’d question anyone who didn’t use some sort of framework, even if it’s their own. Writing efficient, manageable CSS and HTML is difficult. How can you do this starting with a completely blank canvas on every project? Why would you want to do this?

But frameworks are uncreative/not fun/stop you learning properly

All these statements are true. The only way to understand concepts such as the cascade and specificity, and to wrangle CSS and HTML into the UI you want, is through coding CSS and HTML. Anyone who started building web pages when I did is at an advantage in this respect: back in 2007 frameworks didn’t exist; we had to write millions of lines of unintelligible spaghetti handcrafted markup and styles.

If you use something like Bootstrap you don’t need to know how CSS and HTML work together. Just as I can use javascript by installing a jQuery plugin. But my javascript and Bootstrap’s output is verbose, inflexible and always looks the same. The moment I want to do something different with it, I’m stymied. So yes, it’s not “fun” or particularly creative (but it does work, albeit inefficiently.)

To use Tachyons you still need to know what properties and values do. The dib class won’t be of any use unless you understand what display: inline-block does. Tachyons isn’t abstracting away the building blocks of UI; it’s just making them quicker and easier to use.

Sara is right: each project may demand its own UI. The reason that automated website builders like Squarespace soon become too limiting is that they don’t allow for this flexibility. For 90% of simple, brochure sites they’re fine; for anything else they’re maddening. Bootstrap is the Squarespace of frameworks, but Tachyons is lego. Whatever UI you need it’ll help you build it – quickly. And you’ll be able to manage it as it grows.