Twig.js Craft CMS Extensions
Twig.js implementations of Craft CMS's Twig filters.
Usage
npm i twig-craft-cms-filters
var Twig = require('twig')
const twigCraftCms = require('twig-craft-cms-filters')
// Add Craft CMS filters.
twigCraftCms(Twig);
{{ 'Hello World!'|id }}
Filters
A comprehensive list of the filters is available here.
- join
- lower
- upper
- capitalize
- length
- without
- time
- strip_tags
- json_encode
- json_decode
- last
- date
- replace
- timestamp
- split
- url_encode
- merge
- camel
- t
- camelToHypens
*Some of these are dummy filters that don't do anything except keep Twig.js compilation from breaking when these specific functions are used in Twig templates.