hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 301e4c7e78edabc4763cbf992624ad70ec4555b6
parent 0406be3d547749b93dd4fd13e142982915b6ca1f
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date:   Wed, 26 Oct 2016 20:50:12 +0200

Make Amber read from the Afero source file system

Diffstat:
Mtpl/template.go | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git 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
 		}