Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.

Latest commit

 

History

History

provide

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

provide helper (pulvus-provide)

Provide rich dust parameter definitions. Forked from Rich Ragan's dust-motes repository and carried forward as festucam.

Definition

{@provide [optional parameters]}blocks{/provide}

    {@provide [optional params]}
      main block of dust
      {:block1}
        evaluation of this block defines a param named "block1"
      {:block2}
        evaluation of this block defines a param named "block2"
      ... as many blocks as you need params
    {/provide} 

Examples

Find the size of an array and pass the value to a partial
{@provide}
  {>partial size=len /}
{:len}
  {@size key=array /}
{/provide}

Create an ad hoc structure to pass to a partial that expects a particular structure
{@provide}
  {>displayAddress data=struct}
{:struct}
  {"street":"{homeStreet}", "city":"{homeCity}", "state": "{homeState}" }
{/provide}

Usage

Depends on dustjs-helpers module to be loaded first since it adds it's definition to the the dust.helpers property.

In node.js:

require('pulvus-provide');

In browser:

If not using require, load the JS some other way and call it with the dust object. As noted earlier, dustjs-helpers must be loaded earlier.