Craft CMS Twig filters, implemented for Twig.js
npm install twig-craft-cms-filters
Twig.js implementations of Craft CMS's Twig filters.
``javascript`
npm i twig-craft-cms-filters
` javascript
var Twig = require('twig')
const twigCraftCms = require('twig-craft-cms-filters')
// Add Craft CMS filters.
twigCraftCms(Twig);
`
` twig``
{{ 'Hello World!'|id }}
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._