# twig-drupal-filters

> Drupal's Twig filters, implemented for Twig.js

Latest version **3.2.0** (published 2022-10-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install twig-drupal-filters
pnpm add twig-drupal-filters
yarn add twig-drupal-filters
bun add twig-drupal-filters
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2022-10-28 |
| First published | 2016-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/twig-drupal-filters) |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kalamuna |
| Maintainers | johnalbin, robloach, ryanweal, andrewmallis, amykhailova |
| Keywords | Drupal, Twig |

## Links

- npm: https://www.npmjs.com/package/twig-drupal-filters
- Repository: https://github.com/kalamuna/twig-drupal-filters
- Homepage: https://github.com/kalamuna/twig-drupal-filters#readme
- Issues: https://github.com/kalamuna/twig-drupal-filters/issues
- npm.io page: https://npm.io/package/twig-drupal-filters

## Dependencies (2)

- [twig](https://npm.io/package/twig.md) ^1.15.4
- [object-keys](https://npm.io/package/object-keys.md) ^1.1.1

## Recent versions

- 3.2.0 (latest) — 2022-10-28
- 3.1.2 — 2020-05-29
- 3.1.1 — 2020-03-24
- 3.1.0 — 2020-03-04
- 3.0.0 — 2020-02-19
- 2.0.0 — 2018-06-21
- 1.1.0 — 2017-07-18
- 1.0.0 — 2017-06-21
- 0.2.2 — 2017-03-15
- 0.2.1 — 2017-02-27
- 0.2.0 — 2017-02-27
- 0.1.2 — 2017-02-22
- 0.1.1 — 2017-01-10
- 0.1.0 — 2016-12-19

## README

# Twig.js Drupal Extensions

[![Greenkeeper badge](https://badges.greenkeeper.io/kalamuna/twig-drupal-filters.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/kalamuna/twig-drupal-filters.svg?branch=master)](https://travis-ci.org/kalamuna/twig-drupal-filters)

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](https://github.com/kss-node/kss-node/blob/master/builder/base/twig/extend-drupal8/drupal8-extensions.js).

## Usage

``` javascript
var Twig = require('twig')
var twigDrupal = require('twig-drupal-filters')

// Add the filters to Drupal.
twigDrupal(Twig);
```

``` twig
{{ 'Hello World!'|clean_id }}
```

### Filters

A comprehensive list of the filters is [available here](http://www.opin.ca/en/article/twig-filters-drupal-8).

- t
- trans
- placeholder
- without
- clean_class
- clean_id
- render
- path
- url
- format_date
- drupal_escape
- safe_join

### Functions

-   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._

---
_Source: https://npm.io/package/twig-drupal-filters · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
