simplify loading templates
Ted Unangst tedu@tedunangst.com
Tue, 19 Dec 2023 15:28:40 -0500
1 files changed,
10 insertions(+),
20 deletions(-)
jump to
M
web.go
→
web.go
@@ -2791,26 +2791,16 @@ go qotd()
loadLingo() emuinit() - readviews = templates.Load(develMode, - viewDir+"/views/honkpage.html", - viewDir+"/views/honkfrags.html", - viewDir+"/views/honkers.html", - viewDir+"/views/chatter.html", - viewDir+"/views/hfcs.html", - viewDir+"/views/combos.html", - viewDir+"/views/honkform.html", - viewDir+"/views/honk.html", - viewDir+"/views/account.html", - viewDir+"/views/about.html", - viewDir+"/views/funzone.html", - viewDir+"/views/login.html", - viewDir+"/views/xzone.html", - viewDir+"/views/msg.html", - viewDir+"/views/header.html", - viewDir+"/views/onts.html", - viewDir+"/views/emus.html", - viewDir+"/views/honkpage.js", - ) + var toload []string + dents, _ := os.ReadDir(viewDir + "/views") + for _, dent := range dents { + name := dent.Name() + if strings.HasSuffix(name, ".html") { + toload = append(toload, viewDir+"/views/"+name) + } + } + + readviews = templates.Load(develMode, toload...) if !develMode { assets := []string{ viewDir + "/views/style.css",