build-base
This commit is contained in:
@@ -1,9 +1,30 @@
|
||||
// Package assets embeds all web assets (templates + static files) into the binary.
|
||||
package assets
|
||||
|
||||
import "embed"
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user