<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Using Thirdparty helper libraries with jsreport-core]]></title><description><![CDATA[<p>I'm looking at the note on <a href="https://jsreport.net/learn/handlebars" rel="nofollow">https://jsreport.net/learn/handlebars</a> and I see that you can use third party helper libraries with jsreport, and I see the following example.</p>
<pre><code class="language-js">var handlebars = require('handlebars');

var HandlebarsIntl = require('handlebars-intl');
HandlebarsIntl.registerWith(handlebars);
</code></pre>
<p>I can see how to add helpers when using jsreport studio. What I am not sure about is how I could use this with <code>jsreport-core</code> ... would the fragment above go before the <code>init()</code>? after? I tried a few variations, but none of them made the helpers available within the template.</p>
<p>Any pointers would be greatly welcomed.</p>
<p>Thanks!</p>
]]></description><link>https://forum.jsreport.net/topic/373/using-thirdparty-helper-libraries-with-jsreport-core</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 14:05:50 GMT</lastBuildDate><atom:link href="https://forum.jsreport.net/topic/373.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 09 Jan 2018 09:58:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Using Thirdparty helper libraries with jsreport-core on Tue, 09 Jan 2018 10:01:54 GMT]]></title><description><![CDATA[<p>I'm looking at the note on <a href="https://jsreport.net/learn/handlebars" rel="nofollow">https://jsreport.net/learn/handlebars</a> and I see that you can use third party helper libraries with jsreport, and I see the following example.</p>
<pre><code class="language-js">var handlebars = require('handlebars');

var HandlebarsIntl = require('handlebars-intl');
HandlebarsIntl.registerWith(handlebars);
</code></pre>
<p>I can see how to add helpers when using jsreport studio. What I am not sure about is how I could use this with <code>jsreport-core</code> ... would the fragment above go before the <code>init()</code>? after? I tried a few variations, but none of them made the helpers available within the template.</p>
<p>Any pointers would be greatly welcomed.</p>
<p>Thanks!</p>
]]></description><link>https://forum.jsreport.net/post/1775</link><guid isPermaLink="true">https://forum.jsreport.net/post/1775</guid><dc:creator><![CDATA[vvaidy]]></dc:creator><pubDate>Tue, 09 Jan 2018 10:01:54 GMT</pubDate></item><item><title><![CDATA[Reply to Using Thirdparty helper libraries with jsreport-core on Tue, 09 Jan 2018 12:57:51 GMT]]></title><description><![CDATA[<p>The <code>jsreport-core</code> code works. Does it help?</p>
<pre><code class="language-js">var jsreport = require('jsreport-core')({
   tasks: {
       allowedModules: ['handlebars-intl']
   }
})

jsreport.init().then(function () {     
   return jsreport.render({
	   template: {
		  content: '{{formatNumber 10}}',
		  engine: 'handlebars',
                  recipe: 'html',
                  helpers: `var HandlebarsIntl = require('handlebars-intl');
                   HandlebarsIntl.registerWith(handlebars); `
	   }
	}).then(function(resp) {	
     console.log(resp.content.toString())
   });
}).catch(function(e) {
  console.log(e)
})
</code></pre>
]]></description><link>https://forum.jsreport.net/post/1777</link><guid isPermaLink="true">https://forum.jsreport.net/post/1777</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Tue, 09 Jan 2018 12:57:51 GMT</pubDate></item><item><title><![CDATA[Reply to Using Thirdparty helper libraries with jsreport-core on Invalid Date]]></title><description><![CDATA[<p>Yes, I was missing the <code>allowedModules</code> as well as the idea that <code>helpers:</code> could be a string with all the code, let me play around with this as a start, thanks a ton!</p>
<p>More generally, is there access to the <code>handlebars</code> object so I can work more directly with partials, and write more sophisticated helpers that are in my own separate module etc?</p>
<p>Thanks again for your prompt and helpful response!</p>
]]></description><link>https://forum.jsreport.net/post/1781</link><guid isPermaLink="true">https://forum.jsreport.net/post/1781</guid><dc:creator><![CDATA[vvaidy]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Using Thirdparty helper libraries with jsreport-core on Invalid Date]]></title><description><![CDATA[<blockquote>
<p>More generally, is there access to the handlebars object so I can work more directly with partials,</p>
</blockquote>
<p>The trouble here is that by default jsreport runs the templating engines isolated in the extra process. So we cannot expose handlebars object to you. It would work only if you use <code>tasks.strategy='in-process'</code>... I think we should be able to expose the <code>handlebars</code> instance in this case and make it easier for jsreport-core devs to extend it. I will discuss it with <a class="plugin-mentions-a" href="https://forum.jsreport.net/uid/4">@bjrmatos</a> .</p>
]]></description><link>https://forum.jsreport.net/post/1782</link><guid isPermaLink="true">https://forum.jsreport.net/post/1782</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Using Thirdparty helper libraries with jsreport-core on Invalid Date]]></title><description><![CDATA[<p>Yes, that all makes sense. In the meanwhile, I realized I can just run <code>handlebars</code> separately and give the resulting HTML as the <code>template.content</code> ... at which point, we don't really need a templating engine to run within jsreport. In that case, is there a <em>no-op</em> or <em>null</em> templating engine I can use that just passes the input content to the next stage of rendering? I am currently setting it to <code>jsrender</code> which of course, does nothing because there are no tags left by the time it runs. I guess that's fine but I'm wondering if a <em>no-op</em> engine might be a bit more efficient?</p>
<p>Thanks!</p>
]]></description><link>https://forum.jsreport.net/post/1784</link><guid isPermaLink="true">https://forum.jsreport.net/post/1784</guid><dc:creator><![CDATA[vvaidy]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Using Thirdparty helper libraries with jsreport-core on Invalid Date]]></title><description><![CDATA[<p>Yes, sure, doing the engines evaluation on your own is one of the options.</p>
<p>The engine which does nothing is called <code>none</code>.</p>
]]></description><link>https://forum.jsreport.net/post/1785</link><guid isPermaLink="true">https://forum.jsreport.net/post/1785</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>