jsreport / jsreport-handlebars

jsreport handlebars templating engine
GNU Lesser General Public License v3.0
2 stars 4 forks source link

Not able to access 'handlebars' from jsreport-handlebars #5

Closed rchancey closed 6 years ago

rchancey commented 6 years ago

I am trying to add the handlebars-helpers. I am using the jsreport-handlebars package.

const handlebars = require('jsreport-handlebars') jsreport.use(handlebars())

when I try to load the handlebars-helpers: const helpers = require('handlebars-helpers'); and then pass it the handlebars as suggested: jsreport.use(helpers({ handlebars: handlebars }))

I get a type error on hbs..

module initialization error: TypeError at /var/task/node_modules/handlebars-helpers/index.js:36:11 at forIn (/var/task/node_modules/for-in/index.js:12:12) at helpers (/var/task/node_modules/handlebars-helpers/index.js:35:5) at Object. (/var/task/lib/reporting.js:52:14) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (/var/task/index.js:3:18) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19)

how do I add the helpers to the handlebar when it is wrapped by jsreport-handlebars?

Any example here?

pofider commented 6 years ago

This seems like duplicate of the conversation on forum https://forum.jsreport.net/topic/650/how-to-access-handlebars-engine-from-jsreport-handlebars/13

bjrmatos commented 6 years ago

the answer and details were provided here (with an example showing how it works)