|
|
3 years ago | |
|---|---|---|
| .. | ||
| lib | 3 years ago | |
| CHANGELOG.md | 3 years ago | |
| LICENSE | 3 years ago | |
| README.md | 3 years ago | |
| index.js | 3 years ago | |
| package.json | 3 years ago | |
Code for processing filters in pug templates
npm install pug-filters
var filters = require('pug-filters');
filters.handleFilters(ast, filters)Renders all Filter nodes in a Pug AST (ast), using user-specified filters (filters) or a JSTransformer.
filters.runFilter(name, str[, options[, currentDirectory]])Invokes filter through jstransformer.
This is internally used in filters.handleFilters, and is a lower-level interface exclusively for invoking JSTransformer-based filters.
name represents the name of the JSTransformer.
str represents the string to render.
currentDirectory is used when attempting to require the transformer module.
options may contain the following properties:
minify (boolean): whether or not to attempt minifying the result from the transformer. If minification fails, the original result is returned.MIT