func (r *Render) Create() *Render {
	r.Validate()

	layout := r.TemplatesDir + r.Layout + r.Ext

	// root dir
	tplRoot, err := filepath.Glob(r.TemplatesDir + "*" + r.Ext)
	if err != nil {
		panic(err.Error())
	}

	// sub dirs
	tplSub, err := filepath.Glob(r.TemplatesDir + "**/*" + r.Ext)
	if err != nil {
		panic(err.Error())
	}

	for _, tpl := range append(tplRoot, tplSub...) {

		// This check is to prevent `panic: template: redefinition of template "layout"`
		name := r.getTemplateName(tpl)
		if name == r.Layout {
			continue
		}

		r.AddFromFiles(name, layout, tpl)
	}

	return r
}
func (r *Render) Create() *Render {
	r.Validate()

	layout := r.TemplatesDir + r.Layout + r.Ext

	// root dir
	tplRoot, err := filepath.Glob(r.TemplatesDir + "*" + r.Ext)
	if err != nil {
		panic(err.Error())
	}

	// sub dirs
	tplSub, err := filepath.Glob(r.TemplatesDir + "**/*" + r.Ext)
	if err != nil {
		panic(err.Error())
	}

	for _, tpl := range append(tplRoot, tplSub...) {

		// This check is to prevent `panic: template: redefinition of template "layout"`
		name := r.getTemplateName(tpl)
		if name == r.Layout {
			continue
		}

		r.AddFromFiles(name, layout, tpl)
	}

	return r
}
func ( r * Render ) Create ( ) * Render { r . Validate ( ) layout := r . TemplatesDir + r . Layout + r . Ext // root dir tplRoot , err := filepath . Glob ( r . TemplatesDir + " " + r . Ext ) if err != nil { panic ( err . Error ( ) ) } // sub dirs tplSub , err := filepath . Glob ( r . TemplatesDir + " " + r . Ext ) if err != nil { panic ( err . Error ( ) ) } for _ , tpl := range append ( tplRoot , tplSub ... ) { // This check is to prevent `panic: template: redefinition of template "layout"` name := r . getTemplateName ( tpl ) if name == r . Layout { continue } r . AddFromFiles ( name , layout , tpl ) } return r }
// Create goes through the `TemplatesDir` creating the template structure
// for rendering. Returns the Render instance.
Create goes through the TemplatesDir creating the template structure for rendering . Returns the Render instance .