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