diff options
author | Pacien | 2013-07-10 23:52:21 +0200 |
---|---|---|
committer | Pacien | 2013-07-10 23:52:21 +0200 |
commit | b1886d52f4fc462edb5bdc5c18ff8cdcc3546eb8 (patch) | |
tree | 89c682b63ae326cf4c860e2f64afd8960623a50f /common.go | |
parent | 8d1ff0e59f9473b9c98196874ee62e5625380fed (diff) | |
download | foldaweb-b1886d52f4fc462edb5bdc5c18ff8cdcc3546eb8.tar.gz |
Optimize contextual variables generation
Diffstat (limited to 'common.go')
-rw-r--r-- | common.go | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -98,10 +98,12 @@ func compile(dirPath string, elements map[string][]byte, sourceDir, outputDir, s | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | pagePath := strings.TrimPrefix(dirPath, sourceDir) | ||
102 | |||
101 | template := merge(elements) | 103 | template := merge(elements) |
102 | page := mustache.Render(string(template), makeContext(dirPath, sourceDir, outputDir, exts)) | 104 | page := mustache.Render(string(template), makeContext(pagePath, sourceDir, exts)) |
103 | 105 | ||
104 | err := fcmd.WriteFile(path.Join(outputDir, strings.TrimPrefix(dirPath, sourceDir), saveAs), []byte(page)) | 106 | err := fcmd.WriteFile(path.Join(outputDir, pagePath, saveAs), []byte(page)) |
105 | if err != nil { | 107 | if err != nil { |
106 | fmt.Println(err) | 108 | fmt.Println(err) |
107 | return | 109 | return |