diff --git a/lib/consolidate.js b/lib/consolidate.js index d5cf381..f077a35 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -1543,8 +1543,12 @@ exports.vash.render = function(str, options, fn) { engine.helpers[key] = options.helpers[key]; } } + var tmpl = cache(options) || cache(options, engine.compile(str, options)); - fn(null, tmpl(options).replace(/\n$/, '')); + tmpl(options, function sealLayout(err, ctx) { + ctx.finishLayout(); + fn(null, ctx.toString().replace(/\n$/, '')); + }); } catch (err) { fn(err); }