shiyanhui / hero

A handy, fast and powerful go template engine.
https://shiyanhui.github.io/hero
Other
1.57k stars 96 forks source link

跨平台编译之后静态文件css js image 都不能访问 #76

Closed hezhizheng closed 4 years ago

hezhizheng commented 4 years ago

设置了静态文件访问

fs := http.FileServer(http.Dir("static"))
http.Handle("/static/", http.StripPrefix("/static/", fs))

go run main.go 可以访问 跨平台编译之后win->linux 所有的静态文件都404了

如何在模板中设置正确的静态文件路径呢?

hezhizheng commented 4 years ago

使用 go get github.com/rakyll/statik 解决该问题