mquandalle / meteor-jade

The Jade template engine for Meteor/Blaze
http://atmospherejs.com/mquandalle/jade
MIT License
307 stars 39 forks source link

Include dynamic template inside content block? #197

Open markudevelop opened 8 years ago

markudevelop commented 8 years ago

I'm new to jade so sorry if this obvious but I've looked into issues/docs and It seems like "components" block in jade just supports text?

https://github.com/mquandalle/meteor-jade/blob/master/examples/components.jade it works for text but if I want this template in jade how to do that? I'm intersted in {#onlyIfLoggedIn}} part to include dynamic template if it evaluates to true

<template name="layout">
  {{#if Template.subscriptionsReady}}
    {{#onlyIfLoggedIn}}
      <div class="container main">
        {{> Template.dynamic template=main}}
      </div>
    {{/onlyIfLoggedIn}}
  {{/if}}
</template>

<template name="onlyIfLoggedIn">
  {{#if authInProcess}}
    <!--<p>loading ...</p>-->
  {{else}}
    {{#if canShow}}
      {{> UI.contentBlock }}
    {{/if}}
  {{/if}}
</template>

here is one of the option that I've tried

template(name="layout")
  +onlyIfLoggedIn
    | +Template.dynamic(template=main)

template(name="onlyIfLoggedIn")
  if authInProcess
    // <p>loading...</p>
  else
    if canShow
      +UI.contentBlock

Thank you.