This has me a little worried. It looks like consolidate.js has an async api. But you are using it synchronously, this will cause problems with the template engine is in fact asynchronous. It would cause the function to return undefined, instead of the expanded html.