From 9d362cb96c82b5b87ff4a9d750dd361ca9f41eb4 Mon Sep 17 00:00:00 2001 From: Adam Simpson Date: Fri, 3 Nov 2017 11:28:46 -0400 Subject: [PATCH] docs: :memo: add docs around adding helpers. --- README.md | 37 ++++++++++++++++++++++++++++++++++++- package.json | 2 +- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8e253cb..f5fb3be 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,38 @@ # Downpour -Sparkbox implementation of [drizzle-builder](https://www.npmjs.com/package/drizzle-builder) +Sparkbox implementation of [drizzle-builder][db] + + +## Usage + +Downpour exposes the [drizzle-builder][db] as a function to compile handlebars templates into HTML. + +All [drizzle-builder options](https://github.com/cloudfour/drizzle-builder#options) are valid. + +Downpour includes a few handlebars helpers by default: + +- all [@cloudfour/hbs-helpers](https://github.com/cloudfour/core-hbs-helpers/tree/master/lib) +- [ifProd](https://github.com/sparkbox/ifProd-helper) +- [is][assemble] +- [isn't][assemble] +- [split][assemble] + +To add additional helpers create a `helpers` key in the options object like so: + +``` javascript +const downpour = require('downpour'); +const { myHelperFunc } = require('my-helper-package'); + +const opts = { + helpers: { + myHelper: myHelperFunc, + }, +}; + +downpour(opts, cb); + +``` + + +[db]: https://www.npmjs.com/package/drizzle-builder +[assemble]: https://github.com/helpers/handlebars-helpers diff --git a/package.json b/package.json index 2deb288..d3218bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sparkbox/downpour", - "version": "0.0.9", + "version": "0.0.10", "description": "Sparkbox implementation of drizzle-builder", "engines": { "node": ">=6.9.1"