docpad-archive / docpad-plugin-jade

Adds support for the Jade templating engine to DocPad.
Other
17 stars 8 forks source link

Using partials plugin with jade #7

Closed Joebob12 closed 10 years ago

Joebob12 commented 11 years ago

So i've tried a couple things:

  1. @partial('hello.html.md.jade')
  2. :@partial('hello.html.md.jade')
  3. :partial('hello.html.md.jade')

No luck with any of those. Any ideas what I can do?

balupton commented 11 years ago

What are the results/errors that you are getting?

Joebob12 commented 11 years ago

@partial('hello.html.md.jade') just puts "@partial('hello.html.md.jade')" as text. :@partial('hello.html.md.jade') is unexpected token ":" :partial('hello.html.md.jade') says expected "indent", but got "text".

Here is the snippet of my jade file from the Bootstrap/jade skeleton:

.container
  section#content.content!= content
    h1 hello
    :partial('hello.html.md.jade')
  hr
  footer
seniorpreacher commented 11 years ago

You should escape the partial like this:

!= partial('top-menu.html.jade', {anythingToPassToPartial: 1})
dospuntocero commented 11 years ago

I William test it asap! I was doing an jade.eco trick for using the eco partials syntax and that worked... But it sounded a Little bit crazy

El domingo, 2 de junio de 2013, Daniel Salamon escribió:

You should escape the partial like this:

!= partial('top-menu.html.jade', {anythingToPassToPartial: 1})

— Reply to this email directly or view it on GitHubhttps://github.com/docpad/docpad-plugin-jade/issues/7#issuecomment-18810754 .

francisco arenas dospuntocero.cl fb.me/dospuntocero.cl

Joebob12 commented 11 years ago

Can anyone confirm what Edifice posted works? I've tried and can't seem to get it working. Default renders but not my test.jade.html file. ReferenceError: /pathto/myproject/src/layouts/default.html.jade:1 > 1| - var scripts = getBlock('scripts') 2| - var styles = getBlock('styles') 3| 4| //- Prettify Syntax Highlighting getBlock is not defined

seniorpreacher commented 11 years ago

getBlock is not defined so probably you have an error elsewhere. This way, what I commented above is working for me in 3 different places now in my code :)

seniorpreacher commented 11 years ago

Maybe try not to use whitespace in your file name. But that's just a guess..

Joebob12 commented 11 years ago

Ah got it, it was definitely something else. Wasn't throwing an error until I tried using the partial, weird. Anyways works great now, cheers!

dospuntocero commented 11 years ago

!= partial('slideshow.html.jade') syntax works wonders thanks!

francisco arenas dospuntocero.cl fb.me/dospuntocero.cl

2013/6/4 Joebob12 notifications@github.com

Ah got it, it was definitely something else. Wasn't throwing an error until I tried using the partial, weird. Anyways works great now, cheers!

— Reply to this email directly or view it on GitHubhttps://github.com/docpad/docpad-plugin-jade/issues/7#issuecomment-18916211 .

timaschew commented 10 years ago

@Joebob12 so you can close this issue? BTW: You can also use jade's built-in mixins instead of the partial plugin