I've been building gsx, a template compiler that lets you write type-safe
HTML in Go with JSX-style markup. .gsx files hold ordinary Go plus
component declarations; the generator lowers them to plain .x.go that go
build type-checks. The runtime is standard-library only.
A quick taste:
component Card(title string, featured bool) {
<section class={ "card", "card-featured": featured }>
</section>
}
What it gives you:
- Props are generated structs, so wrong prop names/types are compile errors
with real source locations (via //line directives), not runtime surprises.
- Context-aware escaping — text, attribute, URL, CSS, and JS positions each
get the right treatment at codegen.
- Class/attribute merging, explicit JS-valued attributes, and automatic
JSON interpolation for things like hx-vals.
- A gsx dev live-reload loop, an LSP, a tree-sitter grammar, and a VS Code
extension.
Try it in the browser (no install): https://gsxhq.github.io/playground
Docs: https://gsxhq.github.io/ · Source (MIT): https://github.com/gsxhq/gsx
Thanks,
Jackie
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/golang-nuts/f64388d5-122b-4b82-b496-6213d5a72cddn%40googlegroups.com.