Top
Best
New

Posted by mpweiher 22 hours ago

Moving away from Tailwind, and learning to structure my CSS(jvns.ca)
492 points | 307 commentspage 4
jakubmazanec 7 hours ago|
For me, the main thing I love about Tailwind is that I don't have to create ad-hoc class names. No more BEM.
meerita 14 hours ago||
The only problem with Tailwind is its syntax. It is anti-CSS. It is confusing and takes time to get used to. Heck, people even wrote cheat sheets. That makes adoption wrong, because people install it just because everyone else uses it or because the current thing brings it in. A long time ago, before Tailwind, I was writing true, pure functional CSS https://www.fcss.club/manifesto, and I never came back to the old OOCSS or BEM style of structuring all the styles in a project. Components helped a lot with that decision. Today, functional CSS does not make sense only if your website is truly, truly simple. But if your application is more complex, FCSS outshines everything else: speed, rendering, simplicity https://www.fcss.club/syntax, and weightlessness.
thiht 13 hours ago|
> It is confusing and takes time to get used to

I don’t believe Tailwind is inherently worse than pure CSS. If Tailwind had existed from day 1 on the web and you had learned it first you probably wouldn’t say this. In fact, if Tailwind had existed first somehow, and someone came up with CSS as we know it as a new revolutionary library, I’m not sure it would have succeeded.

meerita 13 hours ago||
Well, the old-school way was something like this: h1.font.size = 24pt 100%. Tailwind has its own syntax, so you need to learn it first, which adds extra cognitive load. For things like * { color: } in Tailwind, you have multiple options: text-color, stroke-color, etc. With FCSS, you simply have color--[colorname] { color: … }. It’s simpler and avoids unnecessary cognitive load.
thiht 12 hours ago||
Yeah learning syntax is not rocket science, using that against Tailwind is not a valid argument IMO
prokopton 6 hours ago||
Always happy to see a Tailwind/no-Tailwind flame war.
outlore 14 hours ago||
IMO the killer feature of tailwind is that it lives alongside your React components so you keep things DRY, and you get a design system with type and spacing scales out of the box. It’s a form of constraint that helps create structure. But I think that makes it a victim of its own success. The tailwind spec becomes ever more complicated the more native CSS features it tries to include. I’ve seen tailwind incantations go way beyond editor wrap line

I still like it though. it’s one of those abstractions that actually helped me learn. I would go to the tailwind doc pages and see the underlying css of any class.

There were some other frameworks I got excited about: vanilla extract and stitches, both made by some really talented people. I wonder why those never quite got the same traction…

bitbasher 13 hours ago||
I used Tailwind in one web based product and it was alright, but I'll never go back to using it.

The HTML bloat was really tough to deal with. I spend far more time in HTML than I'd like, and having more Tailwind classes than I do semantic HTML was really tough to look at.

I've settled on using vanilla CSS and applying styles per-page on an as needed basis. For example, include base styles (reset, primary theme, etc) and then include marketing styles (or: blog styles, dashboard styles, syntax highlighting styles, charting styles, etc).

It keeps each page light and minimal. Reading the HTML is easy. Styles stay consistent across any pages that share styles, etc.

dev360 14 hours ago||
Tailwind makes sense when you can use React Components to build a reusable design system. It is annoying as heck to use if you don't have that superstructure.
dev360 14 hours ago|
To add: I dont want to go back to writing semantic css.. no thanks - I dont go in time-back machines. This is a mess.

Just using tailwind and anchoring around a design system like shadcn is just way easier for a team to align around than somebodys made up css language.

bumbledraven 14 hours ago||
TFA links to https://joshcollinsworth.com/blog/tailwind-is-smart-steering, which is about Tailwind, but makes multiple distinctions and points that could just as well apply to LLMs, e.g.:

> Builders value getting the work done as quickly and efficiently as possible. They are making something—likely something with parts beyond the frontend—and are often eager to see it through to completion. This means Builders may prize that initial execution over other long-term factors.

> Crafters are more likely to value long-term factors like ease of maintainability, legibility, and accessibility, and may not consider the project finished until those have also been accounted for.

> In my view, the more you optimize for building quickly, the more you optimize for homogeneity.

HiPhish 13 hours ago||
I just want to point out that you can use Tailwind inside your CSS with the `@apply` directive (not to be confused with the since abandoned CSS `@apply` rule). You write your CSS and mix in Tailwind instructions where it makes sense. Example:

    @import 'tailwindcss';
    
    p {
     @apply text-justify;
     @apply bg-slate-300 dark:bg-slate-800;  /* Second rule just for colors */
     display: block;  /* regular CSS */
    }
I used to be a big Tailwind hater because putting all those utility classes as inline styling into my HTML is a crime against nature. But this way I get the best of both worlds. Tailwind is really nice as higher-level building blocks and saves me from writing a bunch of media queries.
thiht 13 hours ago|
> putting all those utility classes as inline styling into my HTML is a crime against nature.

It’s really not when working with components instead of pages, and when working with variables properly

HiPhish 11 hours ago||
Even with components I prefer what Astro is doing: the component can have a `<style>` tag in which I can add my own CSS. When building the website Astro will know how to transform the CSS so it only applies to that component. This way markup and presentation remain separate even if they are within the same source file.

https://docs.astro.build/en/guides/styling/

icar 7 hours ago||
This feels like reinventing Tailwind, but worse.
moomoo11 2 hours ago|
oh god bikeshedding alert

next thread

More comments...