DEV Community

Discussion on: CSS is an art, and it's dying. A reflection on CSS and JS frameworks and the evolution of CSS

Collapse
 
leastbad profile image
leastbad • Edited

Hi Samson,

I really appreciated your musings on CSS past and future. I am posting because I want to be at least one voice urging you to pay attention to your gut and make intelligent decisions for yourself about how these questions should be answered.

There is an exceptionally toxic undercurrent of weirdly ageist exceptionalism that flows through the current generation of new developers, and regardless of whether you buy into the notion that they are somehow smarter and wiser than all previous generations of web nerds or not, it's hard to argue that they aren't a bit of a gang - with all of the dick measuring and group-think that comes with joining a gang. Gangs are not usually super keen on hearing dissenting views, only that they are the best and they have it all figured out, they are the ones whose ideas will win.

Thing is, when my friends and I created Sass, we weren't trying to win anything. We just saw some clever ways to make working with CSS better, and what do you know, a lot of those ideas are now either in the CSS spec or parroted by every tool that touches it. The same could be said of jQuery: trendy to hate in 2020, but all of these agro nerd sub-bosses seem to forget that we can thank jQuery for the querySelector engine, DOM events and the fetch API.

One of the key motivations behind both Haml and Sass which everyone seems to forget or ignore now, was that the markup itself should be beautiful. This was a good decade before the obfuscate/minify/pack thing took over. We felt pride when we could view source and see the secrets laid bare in a structured, attractive way.

I'll admit, I think CSS-in-JS is an abomination. I think the notion of putting everything into one file is charmingly academic, but incredibly difficult to maintain in the wild. That's just my opinion.

Tailwind is a lot more nuanced. Here's the thing: I'm not a designer. I have a comfortable working understanding of the CSS properties and given enough time I can usually achieve the layouts I see in my mind without too many gross hacks. This means that Bootstrap 4 - the CSS, not so much the JS - has been my go-to weapon of choice and that isn't likely to change, for some excellent reasons.

First of all, Tailwind's open-ended flexibility makes the damning assumption that I've been previously held back from realizing some beautiful design that Bootstrap was making difficult or impossible. The opposite is true: I know when something is ugly, but I absolutely rely on the massive ecosystem of paid and free themes available to Bootstrap developers. You could say that I'm just good enough with CSS to take a theme and customize the last 30% of it so it looks unique to what I'm working on. But if you give me a blank slate, it's going to look like an Intel clean room. I have no ability to mix colors, choose typeography, or conceptualize how a UI should be built up that doesn't start from someone else giving me the foundation to build on. Having all of the raw building blocks is like being gifted a DNA synthesizer and told to make lunch.

Second, that massive theme ecosystem. Tailwind has the official $250 UI component library paying for Adam Wathan's kids to go to college some day. Bravo on that whole endeavor. But it is in no way whatsoever a stand-in for the tens of thousands of themes I can buy for $30. Those themes will save me days or weeks of effort and give me a structure for the kind of app I'm building. Pretending like most of the Bootstrap users don't need themes ignores that the total user base of Tailwind is likely going to hit a hard limit, at least so long as things like Shopify and Wordpress are popular.

Third, that thing I said about caring what the markup looks like. Perhaps my least favourite aspect of Tailwind is the class soup. I know that there's tricks you can do with @apply but by-and-large, Tailwind folks seem to give zero fucks about how ugly what I'll call Tailwind-infected HTML actually looks like. It means that every element on your page is likely wider than your screen on a laptop, and that's kind of nuts. I'm looking at shit like this (click code on any example) and wondering why nobody else is alarmed.

Samson, you are clearly a smart person. Please don't fall into the trap of believing that any of these new technologies have been somehow decided as the way forward. They are really popular in some startup circles and on sites like dev.to, but these are places where the average age is young enough that even the really smart folks haven't been around long enough to see a few pendulum cycles. The future of React, for example, is not the assumption of supremacy some people portray it to be. It was designed for Facebook-sized problems. Most people don't have those, so shame on the bootcamps for teaching young people the trendy thing. Already we're seeing technologies like StimulusReflex and LiveView demonstrating that you can achieve better results, faster than any SPA can be built. So suddenly placing all eggs in the React basket seems regrettable.

Don't go quietly into the JS-for-everything-or-you're-a-nostalgic-dinosaur night.