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

@ministryofjustice/fb-nunjucks-helpers

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ministryofjustice/fb-nunjucks-helpers

Form Builder Nunjucks helpers

  • 0.0.6
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

fb-nunjucks-helpers

Form Builder Nunjucks helpers

Usage

npm install @ministryofjustice/fb-nunjucks-helpers

Set up

const fbNunjucksHelpers = require('fb-nunjucks-helpers')
let nunjucksEnv = nunjucks.configure(views, options)
nunjucksEnv = fbNunjucksHelpers.init(nunjucksEnv)

Adding macros

nunjucksEnv.add(macroPaths)

Adding to a specific namespace

nunjucksEnv.add(macroPaths, namespace)

Global methods available in Nunjucks templates

callBlock

{{ callBlock(data) }}

{{ callBlock({
  _id: 'blockId;,
  _type: 'blockType',
  ...
}) }}

callBlocks

{{ callBlocks([data, data2, data3]) }}

callMacro

{{ callMacro(macroPath, data) }}

setObject

{% set foo = setObject(foo, {prop: 'value'}) %}

setObjectProperty

{% set foo = setObjectProperty(foo, 'prop', 'value') %}

addGlobal

{% set varSink = addGlobal('globalProp', 'value') %}

Test assets

The macro files used for testing are located in lib/spec/macros

FAQs

Package last updated on 01 Aug 2018

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