당신은
sails.on('router:before', function() {
sails.router.bind('/*', function(req, res, next) {
// here you can reimplement the res.render method, of example:
res.render = function render(data) {
// For access `req` data in your template engine,
// many useful info stored here like:
// req.options.controller – current `controller`
// req.options.action – current `action`
data.req = req;
var html = yourTemplateEngineRender(data);
res.set({
'Content-Type': 'text/html',
'Content-Length': Buffer.byteLength(html, 'utf8')
});
res.send(html);
}
}, 'all');
});
는 bem가 돛을 위해 렌더링 할 수 있습니다 내 후크를 참조하십시오 여기에 lib/hooks/views/index.js (당신의 돛 후크에서)와 같은 작업을 수행 할 수 있습니다 sails-hook-bem-render
을