update
This commit is contained in:
@@ -16,11 +16,8 @@ import (
|
|||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed statics/**/*
|
//go:embed tmpl/* statics/**/*
|
||||||
var staticFS embed.FS
|
var f embed.FS
|
||||||
|
|
||||||
//go:embed tmpl/*
|
|
||||||
var tplFS embed.FS
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
@@ -32,10 +29,10 @@ func main() {
|
|||||||
|
|
||||||
r := Router()
|
r := Router()
|
||||||
// 静态文件也打包
|
// 静态文件也打包
|
||||||
tmpl, _ := template.ParseFS(tplFS, "tmpl/*")
|
tmpl, _ := template.ParseFS(f, "tmpl/*")
|
||||||
r.SetHTMLTemplate(tmpl)
|
r.SetHTMLTemplate(tmpl)
|
||||||
staticFS, _ := fs.Sub(staticFS, "static")
|
staticsFS, _ := fs.Sub(f, "statics")
|
||||||
r.StaticFS("/static", http.FS(staticFS))
|
r.StaticFS("/statics", http.FS(staticsFS))
|
||||||
|
|
||||||
//r.LoadHTMLGlob("tmpl/*")
|
//r.LoadHTMLGlob("tmpl/*")
|
||||||
//r.Static("/statics", "./statics")
|
//r.Static("/statics", "./statics")
|
||||||
|
|||||||
Reference in New Issue
Block a user