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
8
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.21
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by33.33%
Maintainers
8
Weekly downloads
 
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 09 Jul 2019

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