mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 18:07:01 +00:00
add support for fs.FS, embed.FS (in addition of string and http.FileSystem) for i18n locales and view engine's templates
This commit is contained in:
@@ -7,13 +7,14 @@ import (
|
||||
"github.com/kataras/iris/v12/x/errors"
|
||||
)
|
||||
|
||||
//go:embed templates/*
|
||||
var embeddedTemplatesFS embed.FS
|
||||
//go:embed embedded/*
|
||||
var embeddedFS embed.FS
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
||||
tmpl := iris.HTML(embeddedTemplatesFS, ".html")
|
||||
tmpl := iris.HTML(embeddedFS, ".html").RootDir("embedded/templates")
|
||||
|
||||
tmpl.Layout("layouts/layout.html")
|
||||
tmpl.AddFunc("greet", func(s string) string {
|
||||
return "Greetings " + s + "!"
|
||||
|
||||
Reference in New Issue
Block a user