【发布时间】:2012-09-07 00:32:35
【问题描述】:
我正在寻找一种在嵌入 Rails 3.2 项目的 Ember.js 应用程序中使用 HAML 编写 Handlebars 模板的方法。
Handlebars 是 1.0.rc.1,需要 ember-rails gem 0.7.0
Ember 是 1.0.pre-90-g60e3c05
无论如何,我的模板现在看起来像这样:
<div id="container">
This is my test
</div>
我希望它是这样的:
#container
This is my test
顺便说一句,我看过 James Harton 的 Hamlbars,但我不知道如何让它发挥作用。它一直输出Ember.TEMPLATES["templates/choose_resort"] = Ember.Handlebars.compile("This is my test"); 而不是预期的:
<div id="container">
This is my test
</div>
(即使返回的似乎未编译的代码中也缺少 div 块)
任何提示将不胜感激。 提前致谢。
【问题讨论】:
-
hamlbars 对我有用 - 它输出 JS(正如您提到的那样),因此您应该将文件命名为 .js.hamlbars 并将其包含在您的清单中。