24 lines
563 B
Go
24 lines
563 B
Go
// Package web bundles the frontend (HTML/JS/CSS) into the Go binary
|
|
// via embed.FS so deploying mCables means shipping one file.
|
|
package web
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
)
|
|
|
|
//go:embed all:static
|
|
var assets embed.FS
|
|
|
|
// Static returns the frontend filesystem rooted at the package's static/
|
|
// dir so callers see index.html at "/".
|
|
func Static() fs.FS {
|
|
sub, err := fs.Sub(assets, "static")
|
|
if err != nil {
|
|
// embed sub-rooting can only fail if "static" doesn't exist,
|
|
// which is a build-time error. Panic is the right shape.
|
|
panic(err)
|
|
}
|
|
return sub
|
|
}
|