./tools/build sed: can't read : No such file or directory #128

Open
pmalek opened this Issue Mar 7, 2016 · 0 comments

1 participant

@pmalek

I have tried generating the static gobyexample with this repo but I get this error

./tools/build
sed: can't read : No such file or directory

So I skipped the build script as it is only this

#!/bin/bash

set -e

tools/format
tools/measure
tools/generate

and I performed

./tools/measure && ./tools/generate

from repository's root and I received the generated files in public/ but without the .html suffixes (and therefore browsers try to download those files instead of parsing and displaying them).

So I performed this small patch:

diff --git a/templates/example.tmpl b/templates/example.tmpl
index dabad82..584ffd7 100644
--- a/templates/example.tmpl
+++ b/templates/example.tmpl
@@ -37,7 +37,7 @@
       {{end}}
       {{if .NextExample}}
       <p class="next">
-        Next example: <a href="{{.NextExample.Id}}">{{.NextExample.Name}}</a>.
+        Next example: <a href="{{.NextExample.Id}}.html">{{.NextExample.Name}}</a>.
       </p>
       {{end}}
       <p class="footer">
diff --git a/templates/index.tmpl b/templates/index.tmpl
index 9c5c02f..65e22ab 100644
--- a/templates/index.tmpl
+++ b/templates/index.tmpl
@@ -35,7 +35,7 @@

       <ul>
       {{range .}}
-        <li><a href="{{.Id}}">{{.Name}}</a></li>
+        <li><a href="{{.Id}}.html">{{.Name}}</a></li>
       {{end}}
       </ul>
       <p class="footer">
diff --git a/tools/generate.go b/tools/generate.go
index 30d7291..8726033 100644
--- a/tools/generate.go
+++ b/tools/generate.go
@@ -270,7 +270,7 @@ func renderExamples(examples []*Example) {
     _, err := exampleTmpl.Parse(mustReadFile("templates/example.tmpl"))
     check(err)
     for _, example := range examples {
-        exampleF, err := os.Create(siteDir + "/" + example.Id)
+        exampleF, err := os.Create(siteDir + "/" + example.Id + ".html")
         check(err)
         exampleTmpl.Execute(exampleF, example)
     }

and now it works. Don't you guys have this problem? Am I doing something wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment