Extending Filters
Syntax:
//- Define custom filter
pug.filters['customFilter'] = function (text, options) {
// Process text and return the result
};
//- Use custom filter in the template
:customFilter
Content to be processed by the custom filter.
Filters in Pug View Engine
Pug is a template engine that can be used to create HTML documents. It’s used to write templates that are then compiled into functions that take in data and render HTML documents.
We will discuss the different types of Filters in Pug Template and their Approaches:
Table of Content
- 1. :markdown:
- 2. :javascript:
- 3. :css:
- 4. :coffee:
- 5. :sass:
- 6. :less:
- Inline Filters:
- Block Filters:
- Extending Filters: