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/playgroundDocs:
https://gsxhq.github.io/ · Source (MIT):
https://github.com/gsxhq/gsxThanks,
Jackie