package web import ( "embed" "io/fs" ) // DistFS holds the production SPA build (npm run build + precompress). // Build scripts must materialize web/dist before `go build`; the directory is // gitignored except dist/.gitkeep, which keeps the pattern satisfiable on // fresh checkouts. LookupDist returns false until a real build lands, so // callers fall back to disk-only mode. // //go:embed all:dist var DistFS embed.FS // LookupDist returns the embedded dist subtree when the build populated it. func LookupDist() (fs.FS, bool) { sub, err := fs.Sub(DistFS, "dist") if err != nil { return nil, false } if _, err := fs.Stat(sub, "index.html"); err != nil { return nil, false } return sub, true }