fupstatic: init embedding package
This commit is contained in:
parent
2104261536
commit
38d9449777
1 changed files with 23 additions and 0 deletions
23
web/fup/fupstatic/fupstatic.go
Normal file
23
web/fup/fupstatic/fupstatic.go
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
package fupstatic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
"io/fs"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed css js
|
||||||
|
var static embed.FS
|
||||||
|
|
||||||
|
var Static fs.FS = newStaticFS(static)
|
||||||
|
|
||||||
|
//go:embed tmpl
|
||||||
|
var templates embed.FS
|
||||||
|
|
||||||
|
var Templates fs.FS = must(fs.Sub(templates, "tmpl"))
|
||||||
|
|
||||||
|
func must(fsys fs.FS, err error) fs.FS {
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return fsys
|
||||||
|
}
|
Loading…
Reference in a new issue