ytdl-web/web/views.go

24 lines
373 B
Go
Raw Normal View History

2023-04-14 11:58:32 -04:00
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
}