Make Amber read from the Afero source file system
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 26 Oct 2016 18:50:12 +0000 (20:50 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 26 Oct 2016 18:50:12 +0000 (20:50 +0200)
tpl/template.go

index a1568b911720e617fdc0c75e1e43e320587ae787..2d8ed29435c783b3f68b9a1d95fa58a48b65cc3d 100644 (file)
@@ -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
                }