internal/static: Bundle resources automatically

This commit is contained in:
Tom Wiesing 2022-10-06 16:38:17 +02:00
parent 9ada07ce70
commit 464b1bf5dd
No known key found for this signature in database
27 changed files with 1503 additions and 28 deletions

View file

@ -20,7 +20,7 @@ func (*Static) Name() string { return "static" }
func (*Static) Routes() []string { return []string{"/static/"} }
func (static *Static) Handler(route string, context context.Context, io stream.IOStream) (http.Handler, error) {
fs, err := fs.Sub(htmlStaticFS, "out")
fs, err := fs.Sub(distStaticFS, "dist")
if err != nil {
return nil, err
}
@ -28,5 +28,5 @@ func (static *Static) Handler(route string, context context.Context, io stream.I
return http.StripPrefix(route, http.FileServer(http.FS(fs))), nil
}
//go:embed out
var htmlStaticFS embed.FS
//go:embed dist
var distStaticFS embed.FS