Transforming Data with Filters

You can transform an expression by providing one or more filters in the template expression. Filters are provided using the | pipe operator.

For example, to upper case the pet’s name:

I have one {{ @pet.type }} named {{ @pet.name | upper }}

Will produce the following:

I have one cat named TIGER

Some filters accept arguments. To pass arguments to a filter, include the arguments list in parentheses: filter(arg1, arg2, ...)

Popular transformation filters are:

  • title: convert text to Title Case

  • truncate: truncate the text with ellipses. For example: @description | truncate(10) to truncate text to 10 characters.

  • join: concatenate values using a separator. For example: @names | join(",")

Under the hood, PixieBrix uses the popular Nunjucks templating language, developed by the non-profit that makes the Firefox web browser!

Last updated