diff --git a/render.go b/render.go index ebd9595..9788772 100644 --- a/render.go +++ b/render.go @@ -12,13 +12,12 @@ import ( var Suffix = ".html.twig" type Pongo struct { - set *pongo2.TemplateSet - basedir string + set *pongo2.TemplateSet } func (p *Pongo) Instance(name string, data interface{}) render.Render { r := new(PongoRenderer) - tpl, e := p.set.FromCache(fmt.Sprintf("%s%s%s", p.basedir, name, Suffix)) + tpl, e := p.set.FromCache(fmt.Sprintf("%s%s", name, Suffix)) if e != nil { panic(e) } @@ -53,9 +52,10 @@ func New(basedir string, debug bool, loaders ...pongo2.TemplateLoader) *Pongo { if !strings.HasSuffix(basedir, "/") { basedir = basedir + "/" } - p.basedir = basedir if len(loaders) > 0 { p.set.AddLoader(loaders...) + } else { + p.set.AddLoader(pongo2.MustNewLocalFileSystemLoader(basedir)) } return p }