node.js - How to reduce code duplication in jade? -


i beginner both web development , node.js. trying build basic news website node.js , express. in home page, hope display featured news, , in page "news" expect display news.

it makes sense home page , "news" page can share jade code display news. using same routes , db node.js functions handle news listing in both places seems straightforward me. wonder whether there way share code , reduce code duplication in jade (perhaps concept "partial" in ruby on rails)?

any or reference links welcomed. thanks!

jade has includes:

html   include includes/head   body     h1 site     p welcome super amazing site.     include includes/foot 

also can use mixins when possible, reduce amount of code need write:

mixin list   ul     li foo     li bar     li baz  h2 groceries mixin list 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -