Permalink
Browse files

Output plain strings instead of string objects with Express

  • Loading branch information...
1 parent 610ab0b commit d09bb91fbe7c41f1a109a29b7176695c4d2eeebb Pierre Matri committed Oct 28, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/kiwi.js
View
5 lib/kiwi.js
@@ -45,7 +45,10 @@ exports.__express = function(filename, options, callback) {
viewOptions.lookupPaths = viewOptions.lookupPaths
.concat(options.settings.views);
}
- new Template(viewOptions).loadAndRender(filename, options, callback);
+ new Template(viewOptions).loadAndRender(filename, options, function(err, result) {
+ if(err) return callback(err);
+ callback(null, result.toString());
+ });
};
// end

3 comments on commit d09bb91

@bazjapan

Thanks for that.

@AlbertoGP

Why didn't you update the NPM package yet?
I just had this problem, and would have had to use another templating engine if it wasn't for a comment in StackOverflow: http://stackoverflow.com/questions/15051299/expressjs-is-returning-json-instead-of-html

I'm looking for a templating engine to use with expressjs, and I like kiwi best so far.
Is the lack of recent changes because it works well, or because you don't have time or interest any more?

@pierreis
coolony member

Oops. Completely forgot this... Just done it. Sorry about that.
At the moment, I'm working on Kiwi 1.0, which will introduce a bunch of new features, and a more robust parser. As it is a complete rewrite of the current engine, I unfortunately don't have the time to introduce these new features for the current branch.

Thanks for noticing, BTW.

Please sign in to comment.