From 8c45320674d51b65e1ce48a82159750a89e549fd Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Sat, 16 Apr 2016 11:10:08 +0100 Subject: [PATCH] Fix wrong template path --- src/hoganjs-utils.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/hoganjs-utils.js b/src/hoganjs-utils.js index a2d6aa4..a4893bf 100644 --- a/src/hoganjs-utils.js +++ b/src/hoganjs-utils.js @@ -19,7 +19,9 @@ } HoganJsUtils.prototype.render = function(namespace, view, params) { - var template = this._getTemplate(namespace, view); + var templateKey = this._templateKey(namespace, view); + + var template = this._getTemplate(templateKey); if (template) { return template.render(params); } @@ -27,12 +29,11 @@ return null; }; - HoganJsUtils.prototype._getTemplate = function(namespace, view) { - var templateKey = this._templateKey(namespace, view); + HoganJsUtils.prototype._getTemplate = function(templateKey) { var template = this._readFromCache(templateKey); if (!template && fs) { - var templatePath = path.join(templatesPath, namespace, view); + var templatePath = path.join(templatesPath, templateKey); var templateContent = fs.readFileSync(templatePath + '.mustache', 'utf8'); template = hogan.compile(templateContent); this._addToCache(templateKey, template);