简体   繁体   English

使用Haml + Mustache在JS和Rails之间共享模板

[英]Sharing templates beetween JS and Rails using Haml + Mustache

I am trying to make common templates that used both by Rails and the client side, ie in coffescript. 我正在尝试制作由Rails和客户端(即在脚本中)使用的通用模板。

I use hogan_assets and haml_assets to export templates to JS. 我使用hogan_assetshaml_assets将模板导出到JS。 However I can't find a way to use HAML and Mustache to render server-side views. 但是我找不到使用HAML和Mustache呈现服务器端视图的方法。

Partial solution is described here , but it doesn't work with view helpers, ie, "render partial" doesn't work. 这里描述部分解决方案,但是它不适用于视图助手,即“渲染部分”不起作用。

For some unknown reason chaining of handlers, such as .mustache.haml, doesn't work, and I can't find neither good info on Rails template handler nor an example on how to build "chainable" handler. 由于某些未知的原因,处理程序(例如.mustache.haml)的链接不起作用,并且我找不到关于Rails模板处理程序的良好信息,也找不到关于如何构建“可链接”处理程序的示例。

我最近一直在尝试使用smt_rails之类的东西,但是我还没有找到一个灵丹妙药。

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

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