4 ms·
Naive question but how would styling be handled actually? If the server just returns plain html tags with content in it ... I mean, I don't quite get it
by jdthedisciple 4y ago
Naive question but how would styling be handled actually? If the server just returns plain html tags with content in it ... I mean, I don't quite get it
- listenallyall 4y agoUsually, the server returns plain HTML tags with Tailwind-enabled 'class' attributes.
- jaredcwhite 4y agoI don't understand why you mentioned Tailwind. Nothing about htmx requires a utility class framework AFAIK.
- quickthrower2 4y agoI think it is snark. The implication is that if he just said “use css classes” in 2022 it wouldn’t be understood by “cool kids” so tailwind is mentioned to clarify what a css class is.
- listenallyall 4y agoHuh? Wasn't meant to be 'snarky' at all. Sure you can use plain CSS classes but Tailwind is immensely popular. Htmx + alpine + tailwind is a fast-growing front-end stack, for good reason. Use it or don't use it, whatever. (the last sentence is snark)
- quickthrower2 4y agoSorry! I guessed wrong
- listenallyall 4y agoBecause the guy asked about styling and Tailwind is by far the most popular CSS styling toolkit. Never said it was "required," just common.
- recursivedoubts 4y agoThe normal way: via a CSS file included in your head.
- jdthedisciple 4y agoYea I figure but I meant actually like layouting and overall decision-making when it comes to how much data should be shown in this or that place, why should the API make those decisions for the client rather than just sending data?
- mixmastamyk 4y agoIt’s not an api but a partial view.
- lawtalkinghuman 4y agoExciting new technology for styling web pages. https://www.w3.org/Style/CSS/ https://www.w3.org/Style/CSS/
- quickthrower2 4y agoThe question makes me think someone is teaching new developers wrong in a complex-thing-first way. Instead of HTML, CSS, JS in that order maybe they got chucked right into a NextJS / Tailwind twitter clone course as their intro to web dev.
- jdthedisciple 4y agoLol naw man that ain't it but i'm surprised apparently nobody got what I was getting at: Say I have my css sheet included, now I still need to set the class and id attributes everywhere I need styling. Are you telling me the client needs to parse the html result and add those manually? Seems absurd. Are you telling me a real Hypermedia API would return stuff like <div class="...">data</div> ? That would seem equally absurd, why would the API concern itself with css classes lol. That's what I don't get
- quickthrower2 4y agoOh I see. Cant speak to the library author’s intent but I think of it like this. Take an old school original rails app. No JS. Nothing. If something is gonna happen it is because you clicked a link or submitted a form. In that app any page is generated by the server and must have any classes defined for css also rendered. So the server is already needing to know about this and inject those classes. With HTMX it is the same thing except you render partials sometimes and sometimes the whole page.
- mixmastamyk 4y agoKISS… use semantic tags when possible. In this example, perhaps table. Classless CSS helpful as well. Beyond that I don’t think adding an id or class here and there is too bad. I’d avoid class heavy frameworks, as I believe you are alluding to.