在Django使用handlebars.js模版

handlebarsjs

Handlebars provides the power necessary to let you build semantic templates effectively with no frustration.

Handlebars templates look like regular HTML, with embedded handlebars expressions.

A handlebars expression is a {{, some contents, followed by a }}

Handlebars.js大概就是供给js渲染的一种模版吧,他是用{{, }}这样的标记,但是会和Django本来的模版标记冲突

verbatim

Stops the template engine from rendering the contents of this block tag.

A common use is to allow a JavaScript template layer that collides with Django’s syntax.

{% verbatim %}
    {{if dying}}Still alive.{{/if}}
{% endverbatim %}

在{% verbatim %}和{% endverbatim %}之间的内容都不会被Django渲染。

参考

关于本文如您有任何想法和意见,欢迎与我们联系,邮箱地址zhi@uqugu.com
您对本文有什么看法,喜欢或者不喜欢都可以发表意见。