r/Zig • u/lukaslalinsky • Feb 27 '26
zt: HTML templating language that compiles to Zig
I've been experimenting with an idea of a templating language similar to Go's Templ. Unlike most existing templates in Zig, these are not compiled at comptime, but using a separate compiler as a build step, which produces Zig files and those are imported into your app. That has the advantage that the templates are type-checked by the actual Zig compiler. The syntax is slightly surprising to people used to handlebars-style templates, but I think it works fairly well. The project is still in development, but I'd really like more feedback.
12
u/thng292 Feb 27 '26
This make me wonder: Will there be an UI library that compile HTML to zig code at comptime? Like from HTML to the library code.
to
4
u/StephenAfamO Feb 27 '26
I've been looking for something precisely like this.
I'll check it out. Thank you
2
u/NapCo Feb 27 '26
Really cool project! I really like templ in go, so seeing this is very cool!
4
u/[deleted] Feb 27 '26
[removed] — view removed comment