News for hackers. Stuff that matters.
Re:Show HN: htmgo - build simple and scalable systems with g... by novoreorx on Sunday September 29, 2024 @09:05AM (#41687111)
Welp, another fasthtml project. I still don't understand the idea of reinventing HTML in another language. It's too restrictive and will never be as compatible as JSX.

Don't get me wrong, I love HTMX, I just don't want to write DSL to generate HTML. IMO a backend language should integrate HTMX similar to how https://hotwired.dev/ works.

Re:Show HN: htmgo - build simple and scalable systems with g... by bilekas on Sunday September 29, 2024 @01:05PM (#41688685)
> 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.

Re:Show HN: htmgo - build simple and scalable systems with g... by imacrayon on Sunday September 29, 2024 @02:15PM (#41689223)
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.

Re:Show HN: htmgo - build simple and scalable systems with g... by maddalax on Sunday September 29, 2024 @02:23PM (#41689295)
This is very cool, I like the website too
Re:Show HN: htmgo - build simple and scalable systems with g... by novoreorx on Sunday September 29, 2024 @09:43PM (#41692652)
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?

Re:Show HN: htmgo - build simple and scalable systems with g... by gwd on Sunday September 29, 2024 @01:53PM (#41689054)
> 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/

Re:Show HN: htmgo - build simple and scalable systems with g... by novoreorx on Sunday September 29, 2024 @09:36PM (#41692596)
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.

Re:Show HN: htmgo - build simple and scalable systems with g... by maddalax on Sunday September 29, 2024 @11:38PM (#41693313)
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
Re:Show HN: htmgo - build simple and scalable systems with g... by maddalax on Sunday September 29, 2024 @10:51PM (#41693053)
What makes you believe the prefix can’t be omitted in htmgo? You just alias it the same way with a ‘.’
Re:Show HN: htmgo - build simple and scalable systems with g... by novoreorx on Monday September 30, 2024 @10:55PM (#41704244)
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.