Twig.js implementations of Drupal's Twig functions and filters. Most of these are just stubbed creations from John Albin's work in KSS-Node.
var Twig = require('twig')
var twigDrupal = require('twig-drupal')
// Add the filters to Drupal.
twigDrupal(Twig);
{{ 'Hello World!'|clean_id }}
A comprehensive list of the filters is available here.
- t
- trans
- placeholder
- without
- clean_class
- clean_id
- render
- path
- url
- format_date
- drupal_escape
- safe_join
- link
- active_theme*
- attach_library*
*These are dummy functions that don't do anything except keep Twig.js compilation from breaking when these Drupal-specific functions are used in Drupal Twig templates.