-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use templates from go-bindata? #23
Comments
I'm interested to. |
1 similar comment
I'm interested to. |
i've got it working this way:
|
@cytec sorry new to Go but where is templates inited to deal with the return |
func loadTemplates(list ...string) multitemplate.Render {
r := multitemplate.New()
for _, x := range list {
templateString, err := Asset("templates/" + x)
if err != nil {
log.Fatal(err)
}
tmplMessage, err := template.New(x).Parse(string(templateString))
if err != nil {
log.Fatal(err)
}
r.Add(x, tmplMessage)
}
return r
}
func main() {
router := gin.Default()
router.HTMLRender = loadTemplates("index.tmpl","_script.tmpl", "_header.tmpl")
router.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.tmpl", gin.H{
"title": "Main website",
})
})
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there any way to use templates from go-bindatas BinaryFileSystem instead of loading them from disk?
The text was updated successfully, but these errors were encountered: