24 lines
373 B
Go
24 lines
373 B
Go
package web
|
|
|
|
import (
|
|
"embed"
|
|
"html/template"
|
|
"net/http"
|
|
|
|
"github.com/gofiber/template/html"
|
|
)
|
|
|
|
//go:embed views/*
|
|
var viewsfs embed.FS
|
|
|
|
func ViewsEngine() *html.Engine {
|
|
engine := html.NewFileSystem(http.FS(viewsfs), ".html")
|
|
engine.AddFunc(
|
|
// add unescape function
|
|
"unescape", func(s string) template.HTML {
|
|
return template.HTML(s)
|
|
},
|
|
)
|
|
return engine
|
|
}
|