Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nunjucks-in-yaml

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

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.

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 24 Nov 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc