How do I render partials with jade without express.js?

Blub picture Blub · Apr 23, 2011 · Viewed 8.1k times · Source

Only info I found was this:

http://forrst.com/posts/Node_js_Jade_Import_Jade_File-CZW

I replicated the suggested folder structure (views/partials) But it didn't work, as soon as I put

!=partial('header', {})
!=partial('menu', {})

into index.jade, I get a blank screen, the error message I receive from jade is:

ReferenceError: ./views/index.jade:3 1. 'p index'
2. ''
3. '!=partial(\'header', {})'

partial is not defined

I'd be very grateful for any help ! (I strongly prefer not to use express.js)

Answer

Wilhelm picture Wilhelm · Jul 21, 2011

Jade has a command called include. Just use

include _form

given that the filename of the partial is *_form.jade*, and is in the same directory