28 lines
657 B
Go
28 lines
657 B
Go
// 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
|
|
}
|