A collection of Dust.js helpers used in DADI+ projects.
npm install @dadi/dustjs-helpers --save
/* app/utils/helpers/loader.js */
// first, a reference to the loaded pages and routes within your application
var components = require('@dadi/web').Components
// also, a reference to the Dust template module inside DADI Web
var dust = require('@dadi/web').Dust
// Load DADI helpers
require('@dadi/dustjs-helpers')(dust.getEngine(), { components: components })
We also recommend including the common DustJS helpers from https://github.com/rodw/common-dustjs-helpers.
npm install common-dustjs-helpers --save
Add the following to your loader.js
file
// Load common-dustjs-helpers
var commonDustHelpers = require('common-dustjs-helpers')
new commonDustHelpers.CommonDustjsHelpers().export_helpers_to(dust.getEngine())
-
Clone this repository
-
Make your changes to
dadi-dustjs-helpers.js
-
Add your tests to
test/test.js
-
Run test suite
npm test
-
Build minified file
npm run build