23 lines
435 B
Go
23 lines
435 B
Go
|
package web
|
||
|
|
||
|
import (
|
||
|
"embed"
|
||
|
"io/fs"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
// To install a Jade compiler: go install github.com/Joker/jade/cmd/jade@latest
|
||
|
//go:generate $GOPATH/bin/jade -pkg=web -writer templates/index.jade
|
||
|
|
||
|
//go:embed assets
|
||
|
var assetsDir embed.FS
|
||
|
|
||
|
func Assets() http.FileSystem {
|
||
|
f, _ := fs.Sub(assetsDir, "assets")
|
||
|
return http.FS(f)
|
||
|
}
|
||
|
|
||
|
func AssetsGetFile(path string) ([]byte, error) {
|
||
|
return assetsDir.ReadFile("assets/" + path)
|
||
|
}
|