0

I'm working on a new project that involves Jade, Express and Node.js (It's my first time plating with any of it)

I'm working on some jade templates. So far I've got a layout page which is just the header for the page I can simply call extends layout at the top of a view.

I also have a navBar block of HTML that I'm going to use on 90% of the pages. Is there a way to do the same thing? I've played with it a little bit and googled some but havent found much regarding it.

Can you use extends or anything like it to put a view inside another one?

This'll save me copy and pasting the whole thing and overall it'll be much neater.

Eogcloud
  • 1,335
  • 4
  • 19
  • 44

1 Answers1

1

Of course! Use include, so if you have a file called navbar.jade in the same directory as other jade files, call include navbar wherever you want to have that navbar.

tymeJV
  • 103,943
  • 14
  • 161
  • 157
  • Thanks for the answer, I've found it really hard to get strong specific info on jade! – Eogcloud Nov 05 '13 at 18:18
  • It's a bit of a struggle, but once you get it, it's awesome. Been using it for a larger application for about 5 months now and loving it. – tymeJV Nov 05 '13 at 18:19
  • Quick follow up, You couldn't by chance specifically define the "block content" line? I've been following a myriad of tutorials and playing with it a lot but I cant nail down specifically what it does or why? – Eogcloud Nov 05 '13 at 18:21
  • 1
    This answer should help: http://stackoverflow.com/questions/14170537/difference-between-include-and-block-in-jade – tymeJV Nov 05 '13 at 18:23