mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
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:
committed by
Bjørn Erik Pedersen
parent
baa62d0abb
commit
3743875778
@@ -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
|
||||||
|
Reference in New Issue
Block a user