31 lines
671 B
Go
31 lines
671 B
Go
// Package assets embeds all web assets (templates + static files) into the binary.
|
|
package assets
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
)
|
|
|
|
// FS contains all files under the web/ directory.
|
|
//
|
|
//go:embed web
|
|
var FS embed.FS
|
|
|
|
// AdminFS returns an fs.FS rooted at web/admin — passed to webadmin.Deps.
|
|
func AdminFS() fs.FS {
|
|
sub, err := fs.Sub(FS, "web/admin")
|
|
if err != nil {
|
|
panic("assets: web/admin missing: " + err.Error())
|
|
}
|
|
return sub
|
|
}
|
|
|
|
// ClientFS returns an fs.FS rooted at web/client — passed to webclient.Deps.
|
|
func ClientFS() fs.FS {
|
|
sub, err := fs.Sub(FS, "web/client")
|
|
if err != nil {
|
|
panic("assets: web/client missing: " + err.Error())
|
|
}
|
|
return sub
|
|
}
|