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

{{tmpl}} serverside aka partials #87

Open BorisMoore opened 13 years ago

BorisMoore commented 13 years ago

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.

mikesamuel commented 13 years ago

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 Githubissues.

  • Githubissues is a development platform for aggregating issues.