sonda/internal/webui/embed_dist.go
tgiachi 249b2cb7bc feat: embed the built web app in sondad behind the webui build tag
internal/webui carries web/'s build (written to internal/webui/dist by Vite, git-ignored) when sondad is built with -tags webui. Without the tag the app is absent and a plain go build and go test still work with no Node. main wires it into the router.
2026-11-12 15:56:34 +01:00

23 lines
421 B
Go

//go:build webui
// Package webui carries the built web app inside the binary.
package webui
import (
"embed"
"io/fs"
)
// dist is what `npm run build` writes in web/: build the app first, then build with -tags webui.
//
//go:embed all:dist
var dist embed.FS
// FS is the built web app, with index.html at its root.
func FS() fs.FS {
sub, err := fs.Sub(dist, "dist")
if err != nil {
return nil
}
return sub
}