asset

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Templates http.FileSystem = http.Dir(path.Join(dir, "templates"))

Templates is the development version of asset.Templates, which is an http Filesystem struct. This must match what is generated from "generate.go". See vfsgen package for details.

Functions

func Load

func Load(name string) (string, error)

Load reads a given asset name from the VFS, and returns it as a string

func Render

func Render(tmpl *template.Template, data interface{}, output io.Writer) error

Render takes a template and renders it complete with data to the given output. This is useful if you want to render a template to a string. See RenderFile if you want a more convenient way to render to a file and have the output closed for you when complete.

func RenderFile

func RenderFile(tmpl *template.Template, data interface{}, output io.WriteCloser) error

RenderFile renders a template with the given data to an output. As opposed to Render, this function will close the output when rendering is complete.

func Template

func Template(name string) *template.Template

Template gets a template from the asset directory, and parses it into a *template.Template object, ready to be Execute'd

Types

This section is empty.

Jump to

Keyboard shortcuts

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