filter

package
v0.0.0-...-22be34c Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package filter contains useful filters to be used in a pipeline.

Index

Examples

Constants

This section is empty.

Variables

View Source
var Verbose = false

Verbose indicates whether to log verbosely

Functions

func AddHeader

func AddHeader(header string) func(*stencil.Asset) error

AddHeader prepends header to each asset's buffer unless it is already prefixed with the header.

func Cat

func Cat(join string, dest string) func(*stencil.Pipeline) error

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

func Load(patterns ...string) func(*stencil.Pipeline) error

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

func ReplacePath(from string, to string) func(*stencil.Asset) error

ReplacePath replaces the leading part of a path in all assets.

ReplacePath("src/", "dist/")

This should be used before the Write() filter.

func ReplacePattern

func ReplacePattern(pattern, repl string) func(*stencil.Asset) error

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

func Str(handler func(string) string) func(*stencil.Asset) error

Str passes asset.Buffer string through any `str` filter for processing. asset.Buffer is assigned then asigned the result value from filter.

func Trace

func Trace() func(*stencil.Asset) error

Trace traces an asset, printing key properties of asset to the console.

func Write

func Write() func(assets []*stencil.Asset) error

Write writes all assets to the file system.

Types

This section is empty.

Jump to

Keyboard shortcuts

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