tylermmorton / tmpl

`tmpl` is a wrapper around Go's html/template package that offers two-way static typing, template nesting and convenient workflow tooling for web developers.
MIT License
52 stars 0 forks source link

Compiler: Include {{define}} tags #7

Open tylermmorton opened 2 weeks ago

tylermmorton commented 2 weeks ago

It would be useful to be able to define sub-templates within a template that is compiled by tmpl

{{ define "greeting" }}
Hello world!
{{ end }}
<p>{{template "greeting"}}</p>

Currently this is not possible because tmpl wraps the template text in its own define tag internally. Instead, these define directives should be extracted and parsed separately, then merged with the main parse tree.

It would also be useful to be able to query the template targets that are available within a compiled template.

tylermmorton commented 2 weeks ago

Related to #4