templates

package
v0.0.0-...-bf4029a Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2018 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reloader

type Reloader struct {
	Templates map[string]*template.Template

	*fsnotify.Watcher
	*sync.RWMutex
}

Reloader holds the required templates, a watcher to watch for changes, and a mutex Mutex will lock our map concurrently

func GetTemplates

func GetTemplates() Reloader

GetTemplates returns a map of templates to their respective parts

func New

func New(dirs ...string) *Reloader

New creates a Reloader so files can be watched for changes concurrently.

func (*Reloader) Get

func (r *Reloader) Get(name string) *template.Template

Get retrieves a template with the given name from the internal map

func (*Reloader) Watch

func (r *Reloader) Watch()

Watch calls a goroutine that waits for fsnotify events and will hot-swap the modified template

Jump to

Keyboard shortcuts

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