Hacker News new | ask | show | jobs
by sgt 325 days ago
For those interested in how to use this with HTMX, read on. DaisyJS supports HTMX as it can work with just plain HTML without needing a fancy JS framework like Vue or React.

You start by setting up something that can serve HTML and with a template engine. My favorite is Django. You also need daisyui, tailwindcss etc in a local NodeJS dir. Those parts aren't too hard, I'll skip over it.

Now you make sure you build a solid base.html with HTMX bits added. HTMX will fetch content from the Django views.

Now if you were using plain Tailwind you'd probably need to use something like django_components to basically make reusable components instead of using HTML. Not with DaisyJS as it simplifies Tailwind vastly; now you can just use <div class="chat-bubble"> and so on, and you get great looking components.

Also use template inheritance and includes, which are basic concepts in Django.

All in all this is a really clean solution that builds future proof apps without a messy JS framework and and SPA that you most likely don't need.

Anyway I'm a big fan of this approach. I get that people have issues with Tailwind itself but one should rather just consider it as a layer of abstraction that we're now skipping.

3 comments

Totally agree, I do use it with Go lang and echo framework which is very light, I have a very simple vite config to build the css and js, reload everything with air, and it's fast and simple.

Edit: I can't prove it but I think even AI coding is more efficient with this approach, clear server side rendering, plain JS with modern features built with vite and CSS classes.

I found daisyui through Jeremy Howard’s (python) fasthtml.
Any repos or articles you can reference that further explore this approach?
Not really. I think I'll do that and put it on my Medium or something.