Ejemplo n.º 1
0
func (r reloadingTemplateRenderer) RenderTemplate(wr io.Writer, ctx handlers.TemplateContext) error {
	templates, err := template.ParseGlob("./templates/*.html")

	if err != nil {
		return err
	}

	return renderWithLayout(templates, wr, ctx.Name(), ctx)
}
Ejemplo n.º 2
0
func (r cachingTemplateRenderer) RenderTemplate(wr io.Writer, ctx handlers.TemplateContext) error {
	if r.templates == nil {
		var err error
		r.templates, err = template.ParseGlob("./templates/*.html")

		if err != nil {
			return err
		}
	}

	return renderWithLayout(r.templates, wr, ctx.Name(), ctx)
}