jet

package module
v0.0.0-...-6648848 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 18 Imported by: 1

README

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Extensions = []string{".jet", ".html"}
)

Functions

func ReadFile

func ReadFile(path string, fs http.FileSystem) ([]byte, error)

Types

type Delims

type Delims struct {
	Left  string
	Right string
}

type Engine

type Engine struct {
	Templates *jet.Set
	// contains filtered or unexported fields
}

func New

func New(r *znet.Engine, directory string, opt ...func(o *Options)) *Engine

New returns a Jet render engine for Fiber

func NewFileSystem

func NewFileSystem(r *znet.Engine, fs http.FileSystem, opt ...func(o *Options)) *Engine

func (*Engine) AddFunc

func (e *Engine) AddFunc(name string, fn interface{}) *Engine

AddFunc adds the function to the template's function map

func (*Engine) Exists

func (e *Engine) Exists(templatePath string) bool

Exists returns whether or not a template exists under the requested path

func (*Engine) Load

func (e *Engine) Load() (err error)

Parse parses the templates to the engine

func (*Engine) Render

func (e *Engine) Render(out io.Writer, template string, data interface{}, layout ...string) error

Execute will render the template by name

type Options

type Options struct {
	Layout     string
	DelimLeft  string
	DelimRight string
	Extensions []string
	Debug      bool
	Reload     bool
}

Jump to

Keyboard shortcuts

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