BorisMoore / jquery-tmpl

The original official jQuery Templates plugin. This project was maintained by the jQuery team as an official jQuery plugin. It is no longer in active development, and has been superseded by JsRender.
3.23k stars 1.01k forks source link

{{wrap}} too complicated, simpler proposal #63

Closed jzaefferer closed 10 years ago

jzaefferer commented 13 years ago

The idea of wrap is good: Enable template composition both by including a subtemplate and wrapping the current template with something else.

But the usage for wrap is way too complicated, with that $item.html method. I tried it and couldn't get it working.

I propose a simpler API for {{wrap "template"}}: Expose a special value in the wrapper and output that via {{html}}, e.g. {{html $wrapped}}. That makes it really easy to use and should be a lot simpler to explain.

geekbuntu commented 13 years ago

it doesn't appear easier (atm), but then again, having sub-templates defined and just calling them inline doesn't seem unreasonable. if you're having difficulty explaining it, then maybe relating it to a stack would help? e.g. you need to show 5 vars on the page. the first template evaluates/publishes the first 3, but the blog date/post count are handled individually? //start: template name main = handles the first3 {{2nd template id = handles blog count}} {{3rd template id = handles the blog date}} //end of main template. likewise, any css will only be used if the template is used, but then again. please explain if i'm missing the point. i just started using this last week.

rdworth commented 13 years ago

Thanks for taking the time to submit this issue. Just wanted to let you know this plugin is no longer being actively developed or maintained by the jQuery team. See README for more info.

geekbuntu commented 13 years ago

{too bad}