简体   繁体   English

不引人注目的jQuery HTML模板

[英]Unobtrusive jQuery html templating

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. 对于MiniProfiler,我们使用beta版的jquery.tmpl证明它与jsRender不兼容,这使某些用户感到痛苦。

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? 有没有一种方法可以以不引人注目的方式加载jquery.tmpl,以便它与可能已经在页面中加载的其他模板引擎一起运行?

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? 是否有其他模板引擎(例如胡须等)可以完全不受干扰地加载,这意味着多个版本可以很好地并排运行?

Sure, jQuery.tmpl can run quite easily in an unobtrusive mode, all that is required is passing it a different jQuery object ... for example: 当然, jQuery.tmpl可以在不干扰的模式下轻松运行,所需jQuery.tmpl就是将其传递给另一个jQuery对象...例如:

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var jQueryMP = $.noConflict();
</script>

then edit the last line on jQuery.tmpl from: 然后从以下位置编辑jQuery.tmpl的最后一行:

})(jQuery);

to: 至:

})(jQueryMP);

您可以尝试我一直在使用的Distal模板引擎

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM