Hey all, I just wanted to share a project I've been working on for the past month.
After years of heavy frameworks, I really like the idea of using htmx, but it’s a little too low level for me and needs a thin layer above it to facilitate things like components, better syntax with complex JS inside of an attribute, etc
To try and solve this problem with a very minimal stack (golang + htmx) that I've been really enjoying, I'm building this project to cater to my needs and was thinking it would be useful for other developers.
> I still don't understand the idea of reinventing HTML in another language.
I switched from using golang templates with hand-crafted HTML to gomponents[1] a few months ago, and it's been amazing. It is so so so much easier to write re-usable components, so much easier to express complicated conditionals, so much nicer to have a type checker helping you not make mistakes.
And of course I like gomponents for the same reason (I presume) JS-oriented people like NodeJS: It's just a lot nicer to have as much as possible written in the same language, be it JavaScript or Golang.
[1] https://www.gomponents.com/
gomponents look better; at least the `h.` prefix could be omitted. Also, it serves a simpler purpose than htmgo.
What do you think about https://templ.guide/? To me, the ability to still write raw HTML in Go is incomparable.
I’m not quite sure what the roadmap looks like for gocomponents but it looks similar but I think it’s only filling one part of the puzzle. My plan for htmgo is to become essentially a ready to use framework for building your whole app, using very fast/lean modules, similar to Ruby on Rails, especially rails 8, and not just an HTML builder
What makes you believe the prefix can’t be omitted in htmgo? You just alias it the same way with a ‘.’
Sorry, I made a mistake. I thought the HTML tag functions were accessed through `ctx`, which is passed to the page function. It's true that we can import them directly to access `Div`, `Class`, etc.
> IMO a backend language should integrate HTMX similar to how https://hotwired.dev/ works.
Turbo stimulus and Strada..
HTMX... Nothing. Just serve it however you feel. In the posts case, they decided to add some tight coupling with go, while not for everyone, is not really a framework.
I appreciate go server for really lightweight banal sites or even light services and htmlx is quickly becoming my new favourite markup. I will say this project isn't for me, but casting it as just another 'fasthtml' project is a bit far off the mark.
I actually created https://alpine-ajax.js.org for this reason. HTMX and Hotwire both have opinionated requirements around the content and status codes that your server returns. One of the goals with Alpine AJAX is you should be able to drop it into any basic CRUD app and have it working without changing any server code.
HTMX for example requires that a successful form submission respond with a 200 status, but many applications (most?) will 302 redirect to a new page to prevent duplicate form request on refresh.
This is very cool, I like the website too
I compare this project to FastHTML for two reasons: 1. They both invented a DSL to write HTML in a functional way. 2. They both integrate with HTMX to provide interactivity.
This is not a criticism or a metaphor, just an observation of their technical similarities. May I ask if there are any aspects I might be unaware of that make you feel this comparison is inappropriate?