jquery-tmpl icon indicating copy to clipboard operation
jquery-tmpl copied to clipboard

{{tmpl}} serverside aka partials

Open BorisMoore opened this issue 14 years ago • 3 comments
trafficstars

Copied from https://github.com/nje/jquery-tmpl/issues#issue/36:

Created 22 days ago by kof This is more a question then bug report.

I am maintaining nodejs port of jquery-tmpl

https://github.com/kof/node-jqtpl

I have implemented partials support via tmpl tag and having some issues with it.

The main question is:

If passing a partial file name like an id to tmpl tag {{tmpl 'partial.html'}}, the current behaviour is if partial exists it will be rendered, if not the string is used as a template. This means there is no error thrown if the template doesn't exist and you have no way to find out why the path is rendered as a template text.

I am thinking about to drop template text support in this tag, becuase I don't really see any good usecases on it. The only one is to loop automatically over array of data and this can be done using "each" tag and is even more understandable.

BorisMoore avatar Mar 10 '11 18:03 BorisMoore

This should be possible under the draft specification. See section 9 of http://wiki.jqueryui.com/w/page/37898666/Template specifically:

""" Flexible loading. Since a plugin takes a map of parse trees, it can find {{tmpl}} calls to templates that are neither in the map of parse trees nor previously compiled; then find their source, parse it, and insert the result into the map of parse trees. The loader that finds

mikesamuel avatar Apr 30 '11 00:04 mikesamuel

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.

rdworth avatar Oct 08 '11 06:10 rdworth

For using the same template in both server-rendering and in the browser, see also the ongoing work on JsViews and JsRender. Take a look at this post for more context.

BorisMoore avatar Oct 13 '11 19:10 BorisMoore