main: embed assets from www to allows PWD to run standalone (#425)
Generate these assets in config because this package is imported by most. Add internal/addgenheader as a simple helper because go-bindata doesn't output the write header. Also update test CI workflow to regenerate and check commit is clean.
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -203,8 +204,15 @@ func initAssets(p *types.Playground) {
|
||||
p.AssetsDir = "default"
|
||||
}
|
||||
|
||||
lpath := path.Join(p.AssetsDir, "landing.html")
|
||||
landing, err := config.Asset(lpath)
|
||||
if err != nil {
|
||||
log.Fatalf("Error loading %v: %v", lpath, err)
|
||||
}
|
||||
|
||||
var b bytes.Buffer
|
||||
t, err := template.New("landing.html").Delims("[[", "]]").ParseFiles(fmt.Sprintf("./www/%s/landing.html", p.AssetsDir))
|
||||
t := template.New("landing.html").Delims("[[", "]]")
|
||||
t, err = t.Parse(string(landing))
|
||||
if err != nil {
|
||||
log.Fatalf("Error parsing template %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user