Awesome, thanks Hiram.
On Wed, Oct 26, 2011 at 7:40 PM, Hiram Chirino <hi
...@hiramchirino.com> wrote:
> Yes it can be done. Try:
> - def button(name: String, href: String)(body: => Unit) =
> .button-container
> a(href=href) = name
> - body
> To be used with (e.g.):
> - button("Push Me", "go.html")
> img(src='foo.png')
> Regards,
> Hiram
> FuseSource
> Web: http://fusesource.com/
> On Wed, Oct 26, 2011 at 5:46 PM, Yang Zhang <yanghates...@gmail.com> wrote:
>> I know you can reuse templates by putting the reusable pieces (e.g.
>> the template for rendering a button) into separate files:
>> -@ val name: String
>> -@ val href: String
>> -@ val body: String
>> .button-container
>> a(href=href) = name
>> .button-body != body
>> and calling:
>> render("button.jade", "name" -> "Push Me", "href" -> "go.html",
>> "body" -> "<img src='foo.png'>")
>> However I'm wondering if there's something that's (1) lighter weight
>> and (2) can pass template blocks, along the lines of:
>> - def button(name: String, href: String)(body: String) =
>> .button-container
>> a(href=href) = name
>> != body
>> To be used with (e.g.):
>> != button("Push Me", "go.html")
>> img(src='foo.png')
>> The lighter-weight definitions would be a boon for small pieces of
>> abstraction/reusability (like buttons), and passing template bodies
>> would give these similar power as layouts.
>> If this doesn't already exist, I think it would make a killer feature.
>> --
>> Yang Zhang
>> http://yz.mit.edu/