# nunjucks-in-yaml

> A YAML extension to use documents in YAML as Nunjucks templates.

Latest version **1.0.4** (published 2020-11-24) · MIT license · 9 weekly downloads

## Install

```sh
npm install nunjucks-in-yaml
pnpm add nunjucks-in-yaml
yarn add nunjucks-in-yaml
bun add nunjucks-in-yaml
```

## 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.4 |
| Published | 2020-11-24 |
| First published | 2020-11-24 |
| Weekly downloads | 9 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 37.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nakamura |
| Maintainers | ittedev |
| Keywords | yaml, nunjucks, mail, email, template, engine |

## Links

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

## Dependencies (2)

- [js-yaml](https://npm.io/package/js-yaml.md) ^3.14.0
- [nunjucks](https://npm.io/package/nunjucks.md) ^3.2.2

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads
- [legichain](https://npm.io/package/legichain.md) — 0 weekly downloads

## Recent versions

- 1.0.4 (latest) — 2020-11-24
- 1.0.3 — 2020-11-24

## README

# nunjucks-in-yaml

A YAML extension to use documents in YAML as Nunjucks templates.

## Install

```shell
npm i nunjucks-in-yaml
```

## Template example

A template files are `--- # {name}`-separated YAML and nunjucks templates.
First section is YAML. Nunjucks templates follows it.

```yaml
from: from@me.email
subject: Thank you for your message!

--- # text

Hi {{ user.name }},

Thank you for your message.

Best regards,

--- # html

Hi <b>{{ user.name }}<b>,

Thank you for your message.

Best regards,

```

## Usage

```js
const loader = require('nunjucks-in-yaml')

const user = {
  name: 'Kurara',
  email: 'kurara@xx.email'
}
const obj = loader.renderSync('test.yml', { user })

console.log(obj)

/* Output:
{
  meta: { from: 'from@me.email', subject: 'Thank you for your message!' },
  text: '\r\nHi Kurara,\r\n\r\nThank you for your message.\r\n\r\nBest regards,\r\n',
  html: '\r\nHi <b>Kurara<b>,\r\n\r\nThank you for your message.\r\n\r\nBest regards,\r\n'
}
 */
```

## Examples

[View here](https://github.com/ittedev/nunjucks-in-yaml/tree/main/examples)

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