internal/static: Bundle resources automatically
This commit is contained in:
parent
9ada07ce70
commit
464b1bf5dd
27 changed files with 1503 additions and 28 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue