About
GoHT is a Go HTML template generator with support for Haml, Slim, and EGO templates.
It takes .goht files, generates type-safe Go code, and lets your application render HTML through normal Go functions.
Why GoHT?
GoHT was created to provide a way to use Haml templates in Go projects. Haml is a concise templating language that is straightforward to read and write. GoHT now supports Haml, Slim, and EGO so projects can choose terse indentation-based templates or HTML-like EGO templates without relying on Ruby or another runtime parser.
Features
- Template Choices: Use Haml, Slim, or EGO in the same
.gohtfile. - Go Based: You can use Go inside templates and can also call out to Go functions from templates. Types and functions from Go code can be used directly in the templates.
- Go Code Generation: GoHT generates Go code from templates. The generated Go code can then be used to render the templates into HTML.
- Type-Safe: GoHT generates type-safe Go code. This means that the generated code will be checked for type errors at compile time. This can help catch errors early in the development process.
- Composition: Use
@render,@children, and named@slotcontent to build reusable layouts and page fragments.