# web-nunjucks

> A Nunjucks interface for DADI Web

Latest version **1.0.2** (published 2020-07-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install web-nunjucks
pnpm add web-nunjucks
yarn add web-nunjucks
bun add web-nunjucks
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-07-06 |
| First published | 2020-02-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 19.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | James Lambie |
| Maintainers | jimlambie |
| Keywords | dadi, web, nunjucks, template |

## Links

- npm: https://www.npmjs.com/package/web-nunjucks
- Repository: https://github.com/jimlambie/web-nunjucks
- Homepage: https://github.com/jimlambie/web-nunjucks#readme
- Issues: https://github.com/jimlambie/web-nunjucks/issues
- npm.io page: https://npm.io/package/web-nunjucks

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) ^4.0.0
- [nunjucks](https://npm.io/package/nunjucks.md) 3.2.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2020-07-06
- 1.0.1 — 2020-04-21
- 1.0.0 — 2020-03-02
- 0.0.1 — 2020-02-20

## README

<img src="https://edge.network/assets/products/dadi-web-full.png" alt="DADI Web" height="65"/>

## Nunjucks engine interface

[![npm (scoped)](https://img.shields.io/npm/v/web-nunjucks.svg?maxAge=10800&style=flat-square)](https://www.npmjs.com/package/web-nunjucks)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)

This module allows [Nunjucks](https://mozilla.github.io/nunjucks/) templates to be used with [DADI Web](https://github.com/dadi/web).

## Installation

- Add this module as a dependency:

   ```
   npm install web-nunjucks
   ```

- Include it in the `engines` array passed to Web:

   ```js
   require('@dadi/web')({
     engines: [
       require('web-nunjucks')
     ]
   })
   ```

## Configuration

The following configuration parameters can be added to the global Web config file, under `engines.nunjucks`.

### `paths`

Paths required by Nunjucks.

- Format: `Object`
- Default:
   ```
   {
     {
       helpers: 'workspace/utils/helpers'
     }
   }
   ```

## Partials


## Filters

To use filters supply the path to your filters in the main Web configuration file:

```json
"engines": {
  "nunjucks": {
    "paths": {
      "filters": "workspace/filters"
    }
  }
}
```

Filters are individual JavaScript files within the specifed directory:

*Example: workspace/filters/uppercase.js*

```js
module.exports = input => {
  return input.toUpperCase()
}
```

## Helpers

To use helpers supply the path to your helpers in the main Web configuration file:

```json
"engines": {
  "nunjucks": {
    "paths": {
      "helpers": "workspace/helpers"
    }
  }
}
```

Helpers are Nunjucks macros stored in individual files within the specifed directory, or all in a single file.

*Example:*

```js
{#
 Returns the full name and price of the supplied product
 Usage: {{ renderProduct product }}
#}

{% macro renderProduct(product) %}
  helper: {{ product.name }} - £{{ product.price }}
{% endmacro %}
```

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