Documentation
¶
Overview ¶
Package filter contains useful filters to be used in a pipeline.
Index ¶
- Variables
- func AddHeader(header string) func(*stencil.Asset) error
- func Cat(join string, dest string) func(*stencil.Pipeline) error
- func Load(patterns ...string) func(*stencil.Pipeline) error
- func ReplacePath(from string, to string) func(*stencil.Asset) error
- func ReplacePattern(pattern, repl string) func(*stencil.Asset) error
- func Str(handler func(string) string) func(*stencil.Asset) error
- func Trace() func(*stencil.Asset) error
- func Write() func(assets []*stencil.Asset) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var Verbose = false
Verbose indicates whether to log verbosely
Functions ¶
func AddHeader ¶
AddHeader prepends header to each asset's buffer unless it is already prefixed with the header.
func Cat ¶
Cat concatenates all assets with a join string. Cat clears all assets from the pipeline replacing it with a single asset of the concatenated value.
func Load ¶
Load loads all the files from glob patterns and creates the initial asset array for a pipeline. This loads the entire contents of the file, binary or text, into a buffer. Consider creating your own loader if dealing with large files.
func ReplacePath ¶
ReplacePath replaces the leading part of a path in all assets.
ReplacePath("src/", "dist/")
This should be used before the Write() filter.
func ReplacePattern ¶
ReplacePattern replaces the leading part of a path in all assets.
ReplacePath("views/", "dist/views")
This should be used before the Write() filter.
Example ¶
egAsset(newAssetText("abcdef", ""), ReplacePattern(`abc`, "x"))
Output: xdef
func Str ¶
Str passes asset.Buffer string through any `str` filter for processing. asset.Buffer is assigned then asigned the result value from filter.
Types ¶
This section is empty.