24 lines
497 B
Go
24 lines
497 B
Go
package dashboard
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
)
|
|
|
|
//go:embed templates/*.html
|
|
var templateFS embed.FS
|
|
|
|
//go:embed static
|
|
var staticFS embed.FS
|
|
|
|
// staticSubFS re-roots staticFS so "static/dashboard.css" is served as
|
|
// "/dashboard.css" under the /static/ route prefix, instead of
|
|
// "/static/static/dashboard.css".
|
|
func staticSubFS() fs.FS {
|
|
sub, err := fs.Sub(staticFS, "static")
|
|
if err != nil {
|
|
panic(err) // embedded at compile time; a bad path here can't happen at runtime
|
|
}
|
|
return sub
|
|
}
|