Socket
Socket
Sign inDemoInstall

nunjucks-in-yaml

Package Overview
Dependencies
23
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nunjucks-in-yaml

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


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

nunjucks-in-yaml

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

Install

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.

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

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

Keywords

FAQs

Last updated on 24 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc