Skip to content

Commit

Permalink
Upgrade express-hbs, and switch to using registerPartial
Browse files Browse the repository at this point in the history
fixes TryGhost#1964, fixes TryGhost#1975

 - Issues with partial handling which caused TryGhost#1964  have been part fixed by handlebars, part worked around by express-hbs, we must use `registerPartials` to ensure partials are handled correctly.
 - Issue with error handling which caused TryGhost#1975 has also been fixed in express-hbs, which now catches the error from handlebars and passes it to express so that we can handle the error with an error page.
  • Loading branch information
ErisDS committed Jan 24, 2014
1 parent cccc198 commit 3961b71
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions core/server/helpers/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ templates.execute = function (name, context) {

// If the partial view is not compiled, it compiles and saves in handlebars
if (typeof partial === 'string') {
partial = hbs.handlebars.compile(partial);
hbs.handlebars.partials[name] = partial;
hbs.registerPartial(partial);
}

return new hbs.handlebars.SafeString(partial(context));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"connect-slashes": "1.2.0",
"downsize": "0.0.4",
"express": "3.4.6",
"express-hbs": "0.5.2",
"express-hbs": "0.7.6",
"fs-extra": "0.8.1",
"knex": "0.5.0",
"moment": "2.4.0",
Expand Down

0 comments on commit 3961b71

Please sign in to comment.