primavera133
primavera133

Reputation: 1314

Can I use includes or macros using Jade?

I'm using Jade as templating engine for an app on node.js/express.

I don't want to repeat code in different views. Is there any way to define macros/includes/functions like in freemarker?

Upvotes: 0

Views: 756

Answers (1)

Raynos
Raynos

Reputation: 169451

Use partial views.

Check out the screencasts specifically the partial view one.

Be wary partials are defined by express and not the view engine. You'll have to emulate them if you want to use your views outside of express (the API for partials is pretty good).

Upvotes: 1

Related Questions