In Express.js, how can I render a Jade partial-view without a “response” object?
问题 Using Express.js, I'd like to render a partial-view from a Jade template to a variable. Usually, you render a partial-view directly to the response object: response.partial('templatePath', {a:1, b:2, c:3}) However, since I'm inside a Socket.io server event, I don't have the "response" object. Is there an elegant way to render a Jade partial-view to a variable without using the response object? 回答1: You can manually compile the Jade template. var jade = require('jade'); var template = require(