diff options
Diffstat (limited to 'resources.go')
-rw-r--r-- | resources.go | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/resources.go b/resources.go index 1a2b706..d689e6f 100644 --- a/resources.go +++ b/resources.go @@ -20,18 +20,18 @@ import ( //go:embed *.go go.mod go.sum //go:embed *.scfg //go:embed Makefile -//go:embed static/* templates/* scripts/* sql/* +//go:embed static/* htmpl/* templates/* scripts/* sql/* //go:embed hookc/*.c //go:embed vendor/* -var source_fs embed.FS +var sourceFS embed.FS -var source_handler = http.StripPrefix( +var sourceHandler = http.StripPrefix( "/:/source/", - http.FileServer(http.FS(source_fs)), + http.FileServer(http.FS(sourceFS)), ) //go:embed templates/* static/* hookc/hookc -var resources_fs embed.FS +var resourcesFS embed.FS var templates *template.Template @@ -40,18 +40,18 @@ func loadTemplates() (err error) { m.Add("text/html", &html.Minifier{TemplateDelims: [2]string{"{{", "}}"}, KeepDefaultAttrVals: true}) templates = template.New("templates").Funcs(template.FuncMap{ - "first_line": first_line, - "base_name": base_name, - "path_escape": path_escape, - "query_escape": query_escape, + "first_line": firstLine, + "base_name": baseName, + "path_escape": pathEscape, + "query_escape": queryEscape, }) - err = fs.WalkDir(resources_fs, "templates", func(path string, d fs.DirEntry, err error) error { + err = fs.WalkDir(resourcesFS, "templates", func(path string, d fs.DirEntry, err error) error { if err != nil { return err } if !d.IsDir() { - content, err := fs.ReadFile(resources_fs, path) + content, err := fs.ReadFile(resourcesFS, path) if err != nil { return err } @@ -71,12 +71,12 @@ func loadTemplates() (err error) { return err } -var static_handler http.Handler +var staticHandler http.Handler func init() { - static_fs, err := fs.Sub(resources_fs, "static") + staticFS, err := fs.Sub(resourcesFS, "static") if err != nil { panic(err) } - static_handler = http.StripPrefix("/:/static/", http.FileServer(http.FS(static_fs))) + staticHandler = http.StripPrefix("/:/static/", http.FileServer(http.FS(staticFS))) } |