使用Django的handlebars.js模板的服务器端渲染

时间:2022-03-03 16:22:55

Is it possible to render handlebar templates with Django? I am trying to avoid providing two copies of each template that needs to be rendered both server-side and client-side.

是否可以使用Django渲染车把模板?我试图避免提供需要在服务器端和客户端呈现的每个模板的两个副本。

2 个解决方案

#1


1  

You want djangobars. Solves your problem quite nicely.

你想要djangobars。很好地解决你的问题。

#2


0  

I've created a custom tag that solves this problem. It iterates through the parser and ignores the handlebars expressions when sandwiched in between {% handlebars %} and {% endhandlebars %}

我已经创建了一个解决此问题的自定义标记。迭代解析器并在夹在{%handlebars%}和{%endhandlebars%}之间时忽略把手表达式

Check it out: https://github.com/anthonysutardja/Django-Template-Handlebars

看看:https://github.com/anthonysutardja/Django-Template-Handlebars

#1


1  

You want djangobars. Solves your problem quite nicely.

你想要djangobars。很好地解决你的问题。

#2


0  

I've created a custom tag that solves this problem. It iterates through the parser and ignores the handlebars expressions when sandwiched in between {% handlebars %} and {% endhandlebars %}

我已经创建了一个解决此问题的自定义标记。迭代解析器并在夹在{%handlebars%}和{%endhandlebars%}之间时忽略把手表达式

Check it out: https://github.com/anthonysutardja/Django-Template-Handlebars

看看:https://github.com/anthonysutardja/Django-Template-Handlebars