Skip to content

Commit

Permalink
Merge pull request #18 from ppowalowski/master
Browse files Browse the repository at this point in the history
dump helper from cache on reloading resolves #17
  • Loading branch information
gakimball committed Dec 7, 2015
2 parents c956e27 + 63aaa54 commit 4c2dc37
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/loadHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ module.exports = function(dir) {
var name = path.basename(helpers[i], '.js');

try {
if(this.Handlebars.helpers[name]){
delete require.cache[require.resolve(path.join(helpers[i]))];
this.Handlebars.unregisterHelper(name);
}
helper = require(path.join(helpers[i]));
this.Handlebars.registerHelper(name, helper);
}
catch (e) {
console.log(e);
console.warn('Error when loading ' + name + '.js as a Handlebars helper.');
}
}
}
}

0 comments on commit 4c2dc37

Please sign in to comment.