No Description

Darko Luketic 0f37076737 added v4 7 months ago
v4 0f37076737 added v4 7 months ago 04327409d9 Update '' 2 years ago
go.mod 0f37076737 added v4 7 months ago
go.sum 0f37076737 added v4 7 months ago
render.go 135199c774 loader(s) must be passed on initialization 2 years ago

pongo2 for gin master branch is used.

If you'd like to use pongo2.v3 see

        package main
        import (
        func main () {
        	r := gin.Default()

            pl := pongo2.MustNewLocalFileSystemLoader("templates")

    		// templates is the basePath
    		// gin.IsDebugging() means if gin is in debug/dev mode then templates
    		// will always be reloaded from disk, otherwise from cache and never
    		// reloaded.
    		pr := ginpongo2.New(gin.IsDebugging(), pl)
    		ginpongo2.Suffix = ".html.twig" // this is default
    		// when ever you render something reference it by prefix
    		// e.g. frontpage = frontpage.html.twig
	    	r.HTMLRender = pr

    		r.GET("/", func(c *gin.Context) {
    			// only pongo2.Context or nil is accepted
	            ctx := make(pongo2.Context)
	            ctx["greeting"] = "hello world"
	            c.HTML(200, "frontpage", ctx)


You can also supply TemplateLoaders. See pongo2.TemplateLoader documentation. It allows you to for example embed resources from a virtual filesystem.