diff --git a/lib/boleto.js b/lib/boleto.js index 073a017..7cf644f 100644 --- a/lib/boleto.js +++ b/lib/boleto.js @@ -1,4 +1,3 @@ -var fs = require('fs') var ejs = require('ejs') var formatters = require('./formatters') var barcode = require('./barcode') @@ -84,9 +83,13 @@ Boleto.prototype.renderHTML = function (callback) { renderOptions['boleto']['linha_digitavel_hash'] = hashString(renderOptions['boleto']['linha_digitavel']).toString() - var html = ejs.renderFile(__dirname + '/../assets/layout.ejs', renderOptions, { + ejs.renderFile(path.join(__dirname, '/../assets/layout.ejs'), renderOptions, { cache: true }, function (err, html) { + if (err) { + throw new Error(err) + } + callback(html) }) }