From: Bjørn Erik Pedersen Date: Wed, 26 Oct 2016 18:50:12 +0000 (+0200) Subject: Make Amber read from the Afero source file system X-Git-Tag: v0.18~158 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=301e4c7e78edabc4763cbf992624ad70ec4555b6;p=brevno-suite%2Fhugo Make Amber read from the Afero source file system --- diff --git a/tpl/template.go b/tpl/template.go index a1568b91..2d8ed294 100644 --- a/tpl/template.go +++ b/tpl/template.go @@ -306,8 +306,14 @@ func (t *GoHTMLTemplate) AddTemplateFile(name, baseTemplatePath, path string) er case ".amber": templateName := strings.TrimSuffix(name, filepath.Ext(name)) + ".html" compiler := amber.New() - // Parse the input file - if err := compiler.ParseFile(path); err != nil { + b, err := afero.ReadFile(hugofs.Source(), path) + + if err != nil { + return err + } + + // Parse the input data + if err := compiler.ParseData(b, path); err != nil { return err }