-@ 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/
- 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/