Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What's up with the colocation argument? Colocation of markup and business logic makes a lot of sense.

Colocation of presentation? Why do you even need that? Presentation is abstracted into CSS by design.

Having presentation decoupled allows you to abstract around visual elements on a page at their instead of having to sufficiently wrap everything in divs classes just to the right level to make the CSs classes work.



The decoupling of CSS and HTML is a lie.

HTML describes layout, not just content.

Your overall structure is going to be vastly different whether you use flex or grid. And if you don’t want to write overly clever CSS you’re wrapping your dt/dd pairs in divs or you put dummy elements into your sections to control where the anchor links scroll to etc. And don’t get me started on non-hierarchical layout relationships.

HTML is not flexible enough and CSS is not expressive enough for this theoretical separation to hold in practice. You would need a translation layer between pure content and layout for this to be true (like XSLT).


I never suggested decoupling html and CSS, that is always going to be coupled through selectors.

What I suggested was decoupling presentation (actual CSS rules) from structure, the blocks of html.

What I'm discussing here is if CSS rules should be inlined in html, whether through tailwind pseudo css or style tags the result is the same.

Further caveat, the article mentions that switching to a CSS file is a context switch. Put it in a style tags next to your html for all I care, colocation is great as a general rule, inlining CSS in html style attributes is not.

This is settled thinking at this point: inlining CSS results in short term benefits to productivity at the cost of long term costs due to brittle presentation that is expensive to change.

And given how low the cost of extracting reusable css classes is these days, I don't think tailwind will ever win.


> Presentation is abstracted into CSS by design.

The structure of your HTML is as integral a part of the presentation as your CSS is.


Yes, it defines the structural bounds your CSS is able to manipulate. It doesn't dictate how it needs to be manipulated other than a rough idea about what things will render out in what order. (I'd hardly call that presentation)

The key point here is that CSS exists precisely because html markup isn't enough on its own to style itself. If it was, CSS wouldn't exist.

The idea that something like tailwind can come in with a bunch of fine grained CSS classes and solve this inate complexity is laughable at best and wildly unprofessional at worst.

It just shows a complete lack of understanding about what html is and isn't and why CSS even exists in the first place.

Fwiw, I get it. Tailwind is a neat shorthand script you can use to pump out trash you'll never look at again. For the rest of us doing actual work on things that we'll need to modify 6 months from now I'd much prefer something readable that I can actually have a hope of modifying even if a teammate wrote the thing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: