Allow hogan to render txt files as well as html

This commit is contained in:
Aron Carroll 2012-06-23 14:31:02 +01:00
parent f6f3067a53
commit b750a2b28f

View File

@ -53,7 +53,7 @@ app.use(middleware.jsonp());
app.use(middleware.helpers(app));
// Create a Hogan/Mustache handler for templates.
app.engine('html', function (path, options, fn) {
function render(path, options, fn) {
fs.readFile(path, 'utf8', function (err, template) {
if (err) {
return fn(err);
@ -70,7 +70,8 @@ app.engine('html', function (path, options, fn) {
fn(error);
}
});
});
}
app.engine('html', render).engine('txt', render);
// Events