Initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// Package web holds the frontend, embedded into the binary. There is no build
|
||||
// step: the templates and assets are hand-written and shipped as-is.
|
||||
package web
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
)
|
||||
|
||||
//go:embed templates/*.html
|
||||
var templatesFS embed.FS
|
||||
|
||||
//go:embed static/*
|
||||
var staticFS embed.FS
|
||||
|
||||
// Templates returns the raw template files, rooted at "templates".
|
||||
func Templates() fs.FS { return templatesFS }
|
||||
|
||||
// Static returns the assets to be served under /static/, with the directory
|
||||
// prefix stripped.
|
||||
func Static() fs.FS {
|
||||
sub, err := fs.Sub(staticFS, "static")
|
||||
if err != nil {
|
||||
panic(err) // impossible: the directory is embedded above
|
||||
}
|
||||
return sub
|
||||
}
|
||||
Reference in New Issue
Block a user