New to Jade, but as far as I can tell, you have two options:
1) create a function in jade itself:
-function sayHi(name){ - return "hello "+name -} p= sayHi('bill')
I think your code is mutating a bit.
2) A better option would be to pass a function from a model
app.get('/', function(req, res){ res.render('home', { title: 'Home' , fs: { sayHi:function(name){ return "hello "+name }} }); });
Then in your jade file you simply:
p= fs.sayHi('bill')
source share