0
0
mirror of https://github.com/rls-moe/nyx synced 2025-08-19 06:18:38 +00:00

Embedded Resources

This commit is contained in:
Tim Schuster
2017-03-15 14:33:27 +01:00
parent 477d3477df
commit 37ba7255fe
9 changed files with 257 additions and 43 deletions

View File

@@ -15,16 +15,6 @@ import (
"time"
)
var riceConf = rice.Config{
LocateOrder: []rice.LocateMethod{
rice.LocateWorkingDirectory,
rice.LocateEmbedded,
rice.LocateAppended,
},
}
var box = riceConf.MustFindBox("http/board/res/")
var (
tmpls = template.New("base")
@@ -57,24 +47,27 @@ var (
}
)
func init() {
var err error
func LoadTemplates() error {
box, err := rice.FindBox("res/")
if err != nil {
return err
}
tmpls = tmpls.Funcs(hdlFMap)
tmpls, err = tmpls.New("thread/postlists").Parse(box.MustString("thread.tmpl.html"))
if err != nil {
panic(err)
return err
}
_, err = tmpls.New("board/dir").Parse(box.MustString("dir.html"))
if err != nil {
panic(err)
return err
}
_, err = tmpls.New("board/board").Parse(box.MustString("board.html"))
if err != nil {
panic(err)
return err
}
_, err = tmpls.New("board/thread").Parse(box.MustString("thread.html"))
if err != nil {
panic(err)
return err
}
}

62
http/board/rice-box.go Normal file

File diff suppressed because one or more lines are too long