Skip to content

neko-contrib/pongo2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Pongo2 Render wercker status GoDoc GoCover

Pongo2.v3 template engine for Neko.

Usage

package main

import (
  "github.com/rocwong/neko"
  "github.com/neko-contrib/pongo2"
)

func main() {
  app := neko.Classic()
  //default: Options{BaseDir: "views", Extension: ".html"}
  //app.Use(pongo2.Renderer())
  
  app.Use(pongo2.Renderer(
    pongo2.Options{
      BaseDir: "template/",
      MultiDir: map[string]string {
        "template-key" : "template2/",
        "custom" : "template3/themes",
      },
      Extension: ".html",
    }),
  )
  app.Run(":3000")
}

func Home(ctx *neko.Context) {
  // use 'BaseDir' path
  ctx.Render("default/index", neko.JSON{})
  // use 'MultiDir' path
  ctx.Render("#template-key/index", neko.JSON{})
}

####type Options

type Options struct {
  // BaseDir represents a base directory of the pongo2 templates.
  BaseDir string
  // MultiDir multiple directories of the pongo2 templates.
  MultiDir map[string]string
  // Extension represents an extension of files.
  Extension string
}

About

Pongo2 template engine for Neko.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published