| 1 | package web |
| 2 | |
| 3 | import ( |
| 4 | "embed" |
| 5 | "io/fs" |
| 6 | ) |
| 7 | |
| 8 | var ( |
| 9 | //go:embed templates/* static/* |
| 10 | allFS embed.FS |
| 11 | TemplatesFS = fsSub(allFS, "templates") |
| 12 | StaticFS = fsSub(allFS, "static") |
| 13 | ) |
| 14 | |
| 15 | func fsSub(fsys fs.FS, dir string) fs.FS { |
| 16 | f, err := fs.Sub(fsys, dir) |
| 17 | if err != nil { |
| 18 | panic(err) |
| 19 | } |
| 20 | return f |
| 21 | } |