lib/templates-loader.js
function() {
        return function (req, res, next) {

            if (!req.locals) {
                req.locals = {};
            }
            var requestTemplates = getTemplates(res);
            req.locals.templates = requestTemplates;
            req.locals.knownTemplates = knownTemplates;
            if (!res.locals) {
                res.locals = {};
            }
            res.locals.templates = requestTemplates;
            res.locals.knownTemplates = knownTemplates;
            res.locals.renderTemplate = invokeRenderTemplate.bind(null, res.locals);

            return next();
        };
    }
function() {
        return function (req, res, next) {

            if (!req.locals) {
                req.locals = {};
            }
            var requestTemplates = getTemplates(res);
            req.locals.templates = requestTemplates;
            req.locals.knownTemplates = knownTemplates;
            if (!res.locals) {
                res.locals = {};
            }
            res.locals.templates = requestTemplates;
            res.locals.knownTemplates = knownTemplates;
            res.locals.renderTemplate = invokeRenderTemplate.bind(null, res.locals);

            return next();
        };
    }
function ( ) { return function ( req , res , next ) { if ( ! req . locals ) { req . locals = { } ; } var requestTemplates = getTemplates ( res ) ; req . locals . templates = requestTemplates ; req . locals . knownTemplates = knownTemplates ; if ( ! res . locals ) { res . locals = { } ; } res . locals . templates = requestTemplates ; res . locals . knownTemplates = knownTemplates ; res . locals . renderTemplate = invokeRenderTemplate . bind ( null , res . locals ) ; return next ( ) ; } ; }
Attaches the 'templates' property to 'locals' pf request and response objects. if no 'locals' found, it is created on demand.
@param req {IncomingMessage}
@param res {ServerResponse}
@param next {Function}
@returns {function} configured middleware function
@api public
Attaches the templates property to locals pf request and response objects . if no locals found it is created on demand .