Version: Next

Filters

Filters let you pipe content through some predefined functions.

Basic Syntax

{{somereference | somefilter |anotherfilter}}

Squirrelly has a filter syntax similar to Nunjucks or Swig. Just put a | and then the filter name. You can pipe to multiple filters if you want.

Filters can also accept parameters.

Example

{{! /* Basic filters */}}
{{mystring | reverse | capitalize}}
{{! /* With Parameters */}}
{{it.someArray | join(", ")}}
Defining Filters

Remember, you'll need to define each filter before you use it.

The safe flag

To disable autoescaping, you can write

{{myreference | safe}}

This isn't a true filter, it just acts as a flag to let Squirrelly know not to autoescape.

Last updated on by Ben Gubler