Skip to content

Commit

Permalink
Force {precompiled: false} option within rendering methods.
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
ericf committed Feb 1, 2013
1 parent 49ddc17 commit 9c1942a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Express3 Handlebars Change History
==================================

NEXT
----

* Force `{precompiled: false}` option within `render()` and `renderView()`
methods to prevent trying to render with precompiled templates.

0.1.2 (2013-01-10)
------------------

Expand Down
12 changes: 12 additions & 0 deletions lib/express3-handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ extend(ExpressHandlebars.prototype, {
}
}

// Force `{precompiled: false}` option, before passing options along to
// `getPartials()` and `getTemplate()` methods.
if (options.precompiled) {
options = extend({}, options, {precompiled: false});
}

async.parallel({
partials: this.getPartials.bind(this, options),
template: this.getTemplate.bind(this, filePath, options)
Expand Down Expand Up @@ -188,6 +194,12 @@ extend(ExpressHandlebars.prototype, {
layoutPath = path.join(this.layoutsDir, layoutPath);
}

// Force `{precompiled: false}` option, before passing options along to
// `getPartials()` and `getTemplate()` methods.
if (options.precompiled) {
options = extend({}, options, {precompiled: false});
}

async.waterfall([
this.render.bind(this, viewPath, options),
renderLayout.bind(this)
Expand Down

0 comments on commit 9c1942a

Please sign in to comment.