package module
Version: v2.0.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 4 Imported by: 0


Renderer implementation of Jet template engine

Build Status Coverage Status Go.Dev reference Go Report Card Release Downloads Chat Community

JetRenderer Jet
v1 v5
v2 v6


See example.

package main

import (


func main() {
	renderer := jetrenderer.New(jet.New(jet.NewOSFileSystemLoader("./views")))
	renderer.SetBeforeRender(func(w io.Writer, name string, vars jet.VarMap, data interface{}, ctx *clevergo.Context) error {
		// populate variables and functions
		// vars.Set("user", user) // user instance.
		// vars.SetFunc("T", translate) // i18n translator.
		return nil

	app := clevergo.New()
	app.Renderer = renderer
	app.Get("/", func(ctx *clevergo.Context) error {
		return ctx.Render(http.StatusOK, "index.tmpl", map[string]interface{}{
			"message": "hello world",




This section is empty.


This section is empty.


This section is empty.


type BeforeRender

type BeforeRender func(w io.Writer, name string, vars jet.VarMap, data interface{}, ctx *clevergo.Context) error

BeforeRender is a listener that listen the event which trigger before rendering.

type Renderer

type Renderer struct {
	// contains filtered or unexported fields

Renderer implementation of clevergo.Renderer for Jet template engine.

func New

func New(set *jet.Set) *Renderer

New returns a renderer with the given set.

func (*Renderer) Render

func (r *Renderer) Render(w io.Writer, name string, data interface{}, ctx *clevergo.Context) error

Render implements clevergo.Renderer.Render.

func (*Renderer) SetBeforeRender

func (r *Renderer) SetBeforeRender(fn BeforeRender)

SetBeforeRender sets before render listener.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL