Jade - print all possible variables

后端 未结 1 497
花落未央
花落未央 2021-01-21 01:35

I would like to be able to display all available variables that the currently loaded jade file has access to.

I realise this is a little odd, but there you go :)

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-21 02:06

    Assign that locals onto a property of itself

    app.use(function locals(req, res, next) {
        res.locals.locals = res.locals;    
        next();
    });
    

    Then simply access locals in your Jade template.

    0 讨论(0)
提交回复
热议问题