From 89178c945e6839c64520f411b9a2f0c884b9d043 Mon Sep 17 00:00:00 2001 From: Arsalan Ahmad Date: Fri, 28 Nov 2014 22:33:12 +0500 Subject: [PATCH] added locals support Added locals support. pass in data to bind to using options.locals --- lib/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index cfbc03b..d339cdb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -19,6 +19,7 @@ function jadepdf(options) { options.paperOrientation = options.paperOrientation || 'portrait'; options.paperBorder = options.paperBorder || '1cm'; options.renderDelay = options.renderDelay || 500; + options.locals = options.locals || {}; var jadeStr = ''; var jadeToHtml = through( @@ -26,7 +27,8 @@ function jadepdf(options) { jadeStr += data; } , function end() { - var html = jade.compile(jadeStr)(); + var fn = jade.compile(jadeStr); + var html = fn(options.locals); this.queue(html); this.queue(null); }