不引人注目的jQuery HTML模板 [英] Unobtrusive jQuery html templating
问题描述
对于 MiniProfiler ,我们使用 jsRender ,这使我们的某些用户感到痛苦.
For MiniProfiler we use the beta version of jquery.tmpl turns out it is incompatible with jsRender, something that is causing pain for some of our users.
是否有一种不干扰方式加载jquery.tmpl的方法,以便它与可能已在页面中加载的其他模板引擎配合使用?
Is there a way to load up jquery.tmpl in an unobtrusive way so it plays nice with other templating engines that may already be loaded in the page?
是否有任何其他模板引擎(例如胡须等)能够以完全不干扰的方式加载,这意味着多个版本可以并排运行,从而发挥出色?
Are there any of the other templating engines (eg. mustache or whatever) that allow themselves to be loaded in a totally unobtrusive way, meaning that multiple versions can run side by side an play nice?
推荐答案
当然,jQuery.tmpl
可以在不干扰的模式下轻松运行,所需要做的就是将其传递给另一个jQuery
对象...例如:
Sure, jQuery.tmpl
can run quite easily in an unobtrusive mode, all that is required is passing it a different jQuery
object ... for example:
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var jQueryMP = $.noConflict();
</script>
然后从以下位置编辑jQuery.tmpl的最后一行:
then edit the last line on jQuery.tmpl from:
})(jQuery);
收件人:
})(jQueryMP);
这篇关于不引人注目的jQuery HTML模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!