Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Renderer ¶
type Renderer struct {
// Minify is true if the template content should be minified. It's possible that the minification code could have
// problems with complex Go templates, but I've not encountered any problems of that nature so far.
Minify bool
// Live is true if the template sets should be reloaded whenever Execute is used.
// This is obviously a very bad idea in production and should only be used for development.
Live bool
// contains filtered or unexported fields
}
Renderer is an object for loading, parsing, minifying and rendering HTML templates.
func NewRenderer ¶
NewRenderer returns an initialized Renderer. The basepath is used to locate all files subsequently added via Load().
func (Renderer) Execute ¶ added in v0.2.0
func (tm Renderer) Execute(templateSet string, wr io.Writer, tmplname string, data interface{}) error
Execute executes the named template from the named template set.
func (*Renderer) Funcs ¶ added in v0.2.1
Funcs sets the function map to be used for all subsequent template load operations.
type TemplateSet ¶ added in v0.2.0
type TemplateSet struct {
// contains filtered or unexported fields
}
TemplateSet represents a set of 1 or more Go templates.
func (*TemplateSet) Load ¶ added in v0.2.0
func (th *TemplateSet) Load() error
Load causes a template set to be loaded from the files in the filesystem. Minification is performed if configured, and the template files are compiled.