Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 949 Bytes

README.md

File metadata and controls

50 lines (39 loc) · 949 Bytes

Twig.js Craft CMS Extensions

Build Status

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.