Documentation ¶
Index ¶
- Constants
- Variables
- func DistRoot(dist string) anOption
- func Helpers(helpers ...template.FuncMap) anOption
- func Minifier(mimetype string, minifier helpers.Minifier) anOption
- func ParseFile(files ...string) anOption
- func ParseFileList(ffile string, files ...string) anOption
- func ParseGlob(globs ...string) anOption
- func ResourceRoot(base string) anOption
- func URLBase(root string) anOption
- type BConfig
- type Template
- func (t *Template) BuildCSSFile(fnames string) (filename string, err error)
- func (t *Template) BuildJSFile(fnames string) (filename string, err error)
- func (t *Template) BuildMimeTypeFile(mimetype string, fnames string) (filename string, err error)
- func (t *Template) Execute(w io.Writer, data interface{}) error
- func (t *Template) LinkToAndBuildCSSFile(fnames string) (template.HTML, error)
- func (t *Template) LinkToAndBuildJSFile(fnames string) (template.HTML, error)
- func (t *Template) ParseFiles() (*Template, error)
Constants ¶
const ( // SrcFileList is a file that contains a list of ParseFiles. SrcFileList = sourceType(iota) // SrcParseFile is just a ParseFile SrcParseFile // SrcGlobFile is a glob that may or may not result in ParseFiles. SrcGlobFile )
Variables ¶
var DefaultBase string
DefaultBase is the default base directory for finding resources.
Functions ¶
func DistRoot ¶
func DistRoot(dist string) anOption
DistRoot is the directory that the build files are going to get written to.
func Helpers ¶
Helpers allow you add helper methods to the template. If the value of the map is not a function that can be accepted or the name of the function is not something that can be a function name, this method will panic.
func ParseFile ¶
func ParseFile(files ...string) anOption
ParseFile will add the file provided to the set of files to parse for the template.
func ParseFileList ¶
ParseFileList will add the files from one or more file lists to the set of files to parse for the template. File are reparsed in debug more for each execute statement.
func ParseGlob ¶
func ParseGlob(globs ...string) anOption
ParseGlob will add files it finds from the provided globs to the list of files to parse for the template.
func ResourceRoot ¶
func ResourceRoot(base string) anOption
ResourceRoot sets the base directory to use when resolving any resource.
Types ¶
type BConfig ¶
type BConfig []anOption
BConfig is the main object that holds the config for BaseConfig.
func BaseConfig ¶
func BaseConfig(options ...anOption) BConfig
BaseConfig creates a base config that can be used to create other templates from it without have to respecify the options.
type Template ¶
Template is the main template object.
func (*Template) BuildCSSFile ¶
BuildCSSFile is a helper function that takes a set of filename and generated a combined (minimizied if a minimizer is provided) Javascript file.
func (*Template) BuildJSFile ¶
BuildJSFile is a helper function that takes a set of filename and generated a combined (minimizied if a minimizer is provided) Javascript file.
func (*Template) BuildMimeTypeFile ¶
BuildMimeTypeFile is a helper function that takes a MimeType and a set of filenames and generated a combined (minimizied if a minimizer is provided) file.
func (*Template) Execute ¶
Execute will reparse all the template, then execute the template with the given data.
func (*Template) LinkToAndBuildCSSFile ¶
LinkToAndBuildCSSFile is the same as the buildCSSFiles but will return a link tag contain the appropriate URL.
func (*Template) LinkToAndBuildJSFile ¶
LinkToAndBuildJSFile is the same as the buildJSFiles but will return a script tag contain the appropriate URL.
func (*Template) ParseFiles ¶
ParseFiles will parse the files that have been build up