I wish there is an equivalent of Storybook for these things though, it would be really nice!
Closures, modules, functions, loops or recursion, conditionals, every feature of your programming language just right there, without some large templating library in the way. Debug your templates with the actual debugger. Very high performance with just a bit of care in the API design. Every programmer in your language can pick this up very quickly with hardly any effort and doesn't have to learn yet another complete templating language to start using your project, it's just comparable to picking up an API.
So many advantages... it's just... you have to be programmer if you want to modify the resulting code. Other than that, and I guess the fact you need to implement whatever discipline you may want on your own[1]... but those are a total killer in many cases.
[1]: This approach does not require that you mix presentation and logic, but if you want that separation, you will need to discipline yourself to maintain it. Though I have to admit, 25 years of programming on the web and I'm frankly still unconvinced by this argument, or, at least, unconvinced that it is the absolute most important thing in every context and only a cretinous lunatic would dare mix logic and presentation. It seems to me to be a rule espoused by far more people than it is followed by.
I don't see any used of a `Script()` function or similar in the example apps, though you could always chunk some JS in a public directory and link it in the HTML.
They do have a starter example that uses HTMX. That'd be my go-to as well for a tool that's sticking with server rendering HTML.
For me, gomponents is the middle ground. You don't get everything, but quite a lot of JSX-like feel. I was inspired by JSX after all. :) [1] Although I called it GOX back then… :D
[0]: https://templ.guide [1]: https://www.maragu.dk/blog/gomponents-declarative-view-compo...
That said, there's gomponents-htmx [0] for easy integration with HTMX.
You may also be interested in the "go podcast()" episode I was in earlier this week, talking about gomponents with Dominik: https://gopodcast.dev/episodes/045-gomponent-with-markus-wus...
Now that the pendulum has swung in favor of rendering HTML server-side again and sprinkling Javascript on top, I sense a lot of interest in different ways of doing things than the default backend + JSON HTTP API + React/Vue frontend stack. And because Go is such a relatively simple language, maybe purely frontend/design-focused developers can pick it up and start writing HTML components with it?
(It helps that my preferred style of putting all HTML components inside a package called "html" inside the Go module/app could neatly containerize newcomers, to not scare them off with all the other stuff that is a Go app.)
Given the minimal syntactic overhead and the do-syntax overload/Monad type class, Haskell is a great language to do these embedded DSLs in.
Typical gophers, can’t accept that there’s a time and place for everything and need to have a hard rule to use that applies to every single situation. Imagine that code, but with gomponents.Ul, gomponents.Li, gomponents.Div everywhere.
Fun fact: I got the idea from an episode of the GoTimeFM podcast, where the hosts and guests were discussing features they would like to see removed from the language.