helpers

package
v0.0.0-...-c233dbf Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JSMimeType is the mime type for javascript files.
	JSMimeType = "text/javascript"
	// CSSMimeType is the mime type for CSS files.
	CSSMimeType = "text/css"
	// TXTMimeType is the mime type for Text files
	TXTMimeType = "text/plain"
	// JSONMimeType is the mime type for JSon files.
	JSONMimeType = "text/json"
)

Variables

Helpers are the helper functions for the templates. This is the same as template.FuncMap

View Source
var ReloadAlways bool

ReloadAlways controls weather the system will reload files ignoring the file existence check.

Functions

func BuildFile

func BuildFile(dist string, min Minifier, mimetype, oldname string, filenames ...string) (filename string, err error)

BuildFile will take the list of files concatenated and minify (if a minifier is provided) them. As the order of the files can be important we take the order of the file provided. If a file is listed more then once, only the first listing will be included.

Types

type BuildError

type BuildError []FileError

BuildError is the error type that can be generated during a build. It will be a collection of errors that can result.

func (BuildError) Error

func (be BuildError) Error() string

type FileError

type FileError struct {
	Filename string
	Error    error
}

FileError tracks the filename and the error that was produced trying to read or build the file.

type KeyValueType

type KeyValueType struct {
	Key   string
	Value string
}

KeyValueType is the item type for a ordered map.

type Minifier

type Minifier interface {
	Minify(mimetype string, w io.Writer, r io.Reader) error
}

Minifier is a type used to minifiy the source.

type OrderedMapType

type OrderedMapType []KeyValueType

OrderedMapType provides an ordered map.

func (OrderedMapType) Exists

func (omap OrderedMapType) Exists(key string) bool

Exists Checks to see if the key exists in the map.

func (OrderedMapType) ExistsAt

func (omap OrderedMapType) ExistsAt(key string) (at int, ok bool)

ExistsAt returns if the items exists in the map, and where at.

func (OrderedMapType) Set

func (omap OrderedMapType) Set(key, value string) OrderedMapType

Set allows you to associate a key with the value. It will override any existing value for that key.

Jump to

Keyboard shortcuts

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