News for hackers. Stuff that matters.
Re:Play with TailwindCSS in the Browser by Vinnl on Friday June 10, 2022 @11:08AM (#31695241)
If you're using a component-based architecture (e.g. when using React, Vue or Angular), otherwise it can get pretty annoying. But if you do, it's pretty great; you don't really need the abstraction of reusable classes, when you already have reusable components, and getting rid of useless abstractions makes me a happy programmer.
Re:Play with TailwindCSS in the Browser by aaronbrethorst on Friday June 10, 2022 @12:04PM (#31696018)
This isn't meant as a contradiction of your point, but there are plenty of ways to use component-based architectures with server-side rendered apps, too, like GitHub's ViewComponent gem for Rails. https://viewcomponent.org

Also, I'd go so far as to say that if you're not using a component based architecture for your web app's view layer, you're creating a ton of extra work for yourself.

Re:Play with TailwindCSS in the Browser by cgarvis on Friday June 10, 2022 @02:28PM (#31697713)
+1 Using it in a Elixir/Liveview app. Using phx_component_helper has made making those components really easy. https://phx-component-helpers-demo.onrender.com
Re:Play with TailwindCSS in the Browser by inopinatus on Friday June 10, 2022 @07:44PM (#31700585)
I’d add you don’t even need ViewComponent. Layouts, partials, variants, and helper functions provide plenty of heavy lifting options when it comes to refactoring your HTML.

My take on ViewComponent: it’s what helper functions become when they grow up into proper objects. Great for larger projects, may be more infrastructure than necessary for smaller ones, adopt incrementally when they seem compelling.

Re:Play with TailwindCSS in the Browser by aaronbrethorst on Saturday June 11, 2022 @05:51PM (#31708797)
Don't need it, but I've found ViewComponent to be a big win over partials. Being explicit with the available state instead of implicit has helped me catch plenty of bugs.
Re:Play with TailwindCSS in the Browser by Vinnl on Sunday June 12, 2022 @06:10AM (#31713365)
Yep exactly, and Tailwind does indeed still make sense with that approach!
Re:Play with TailwindCSS in the Browser by nojs on Friday June 10, 2022 @11:23AM (#31695438)
I am using it with traditional Django + Jinja2 for templating now which is working well. With {% macro %} you basically get fully reusable “components” on the backend so there’s limited copy pasting of tailwind classes.
Re:Play with TailwindCSS in the Browser by debrice on Friday June 10, 2022 @11:13AM (#31695306)
I would add that, even for regular HTML you can write CSS using @apply and still leverage the nice structure tailwind provides while creating your component CSS classes.
Re:Play with TailwindCSS in the Browser by rawfan on Saturday June 11, 2022 @04:59AM (#31703014)
You can also just use regular webcomponents and make re-usable components regardless of frontend or backend usage.