akdubya / dustjs

Asynchronous templates for the browser and node.js
http://akdubya.github.com/dustjs/
MIT License
1.44k stars 131 forks source link

Global alias or how to pull a block #57

Open nistormihai opened 12 years ago

nistormihai commented 12 years ago

I'm trying to write a base template with blocks witch after in a child template to reuse only some blocks from the base template and I followed global alias help for dust but when I use them with partial doesn't want to work.

greeting.dust

{<greeting}Hello, Hola{/greeting}   
{<world} Us, Spain{/world}

partial_end.dust

{#names}
  {.} {+greeting/}
{/names}

{#projects}
  {.} {+greeting/}
{/projects}
{>greeting_template/}

partial_begining.dust

{>greeting_template/}
{#names}
  {.} {+greeting/}
{/names}

{#projects}
  {.} {+greeting/}
{/projects}

In only one file it works like this:

greeting_begining.dust

{<greeting}Hello, Hola{/greeting}   
{<world} Us, Spain{/world}
{#names}
  {.} {+greeting/}
{/names}

{#projects}
  {.} {+greeting/}
{/projects}

but I need to separate the blocks in other files. Can some one help? I there any other way of doing this? If now there is an real issue with this maybe I can contribute to dust and try to fix this.

PS: from the main examples it seem that blocks are global when included from partials, but this is the other way around.