Skip to content

Commit

Permalink
Cheap fix for dominicbarnes#22
Browse files Browse the repository at this point in the history
The quickest/dirtiest way of fixing dominicbarnes#22 is to hold those options passed
on this.render on the instance, then use them when `handlebars.compile`
is calling `compileTemplate`.
  • Loading branch information
HowlingEverett committed Oct 8, 2015
1 parent dc82705 commit c5f359b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Renderer.prototype.getFile = function *(file) {
Renderer.prototype.compileTemplate = function *(file) {
var meta = yield this.getFile(file);
debug("compiling template %s", chalk.grey(path.relative(this.options.root, file)));
meta.fn = this.handlebars.compile(meta.body);
meta.fn = this.handlebars.compile(meta.body, this.compileOptions);
meta.render = function (locals, options) {
return this.fn(locals, options);
};
Expand Down Expand Up @@ -285,9 +285,9 @@ Renderer.prototype.helper = function (name, fn) {
*/
Renderer.prototype.render = function *(template, locals, options) {
var o = this.options;

locals = extend(true, {}, locals);
options = extend(true, {}, { data: o.data }, options);
this.compileOptions = options;
debug("rendering %s template", chalk.underline(template));

// extract layout id
Expand Down

0 comments on commit c5f359b

Please sign in to comment.