communibase-render-tools
v0.0.6communibase-render-tools
A collection of helper functions to simplify the use of Communibase data in Templates.
Consists of
TemplateDataFactory Enrich Communibase-data in any way possible for easy use in dynamic templates.
Handlebars helpers A set of helpers for the Handlebars template engine, configured for datatypes as coming from the communibase service
Promisified rendering of template files and string A pre-promisified interface for the Handelbars render engine.
Example usage:
var tools = require('communibase-render-tools');
var factory = new tools.TemplateDataFacory({ ... your options ...});
factory.getTemplateDataPromise("Person", person).then(function () { ... })
// and / or
Handlebars.registerHelper(tools.handlebarsHelpers);
// and / or
tools.renderFile('myTemplate.hbs', {}).then(...)
Constructor options
All options for the constructor are optional. Possible options:
cbc: an instance of the Communibase Connector. Will be spawned if not supplied
maxNestLevel: Default 5. How deep should getTemplateData
iterate with retrieving data.
Tool methods
Expand all possible paths for a certain document, making it more easy to use it as a source for templates.
tool.getTemplateDataPromise(entityTypeTitle, document)
Source Code
github.com/kingsquare/commun...Metadata
- BSD-2-Clause
- Whatever
- Kingsquare BV
- released 10/14/2014