tpl/tplimpl: Fix compiling Amber templates that import other templates

Without this patch, amber would try to load templates from the OS filesystem
instead of the layouts virtual filesystem.
This commit is contained in:
Steven Allen 2018-08-17 08:04:07 +00:00 committed by Bjørn Erik Pedersen
parent baa62d0abb
commit 3743875778

View file

@ -17,10 +17,12 @@ import (
"html/template" "html/template"
"github.com/eknkc/amber" "github.com/eknkc/amber"
"github.com/spf13/afero"
) )
func (t *templateHandler) compileAmberWithTemplate(b []byte, path string, templ *template.Template) (*template.Template, error) { func (t *templateHandler) compileAmberWithTemplate(b []byte, path string, templ *template.Template) (*template.Template, error) {
c := amber.New() c := amber.New()
c.Options.VirtualFilesystem = afero.NewHttpFs(t.layoutsFs)
if err := c.ParseData(b, path); err != nil { if err := c.ParseData(b, path); err != nil {
return nil, err return nil, err