2022-06-27 04:38:09 +04:00
|
|
|
package web
|
|
|
|
|
|
|
|
import (
|
|
|
|
"embed"
|
2023-06-13 00:02:41 +04:00
|
|
|
"io/fs"
|
2022-06-27 04:38:09 +04:00
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2023-06-12 23:32:09 +04:00
|
|
|
//go:generate $GOPATH/bin/jade -pkg=web -stdbuf -writer templates/index.jade
|
2023-08-13 02:23:47 +04:00
|
|
|
//go:generate $GOPATH/bin/jade -pkg=web -stdbuf -writer templates/errorXXX.jade
|
2022-06-27 04:38:09 +04:00
|
|
|
|
|
|
|
//go:embed assets
|
|
|
|
var assetsDir embed.FS
|
|
|
|
|
|
|
|
func Assets() http.FileSystem {
|
2023-06-13 00:02:41 +04:00
|
|
|
f, _ := fs.Sub(assetsDir, "assets")
|
|
|
|
return http.FS(f)
|
2022-06-27 04:38:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
func AssetsGetFile(path string) ([]byte, error) {
|
|
|
|
return assetsDir.ReadFile("assets/" + path)
|
|
|
|
}
|