我试图将ECO模板与主干和木偶结合使用,但不使用Rails。相反,我使用姜戈和RequireJS管理我的前端资产管道。
如何加载ECO模板?
下面是使用下划线模板的简单Marionette视图的样子:
define ['cs!app', 'requirejs-tpl!./templates/message.tpl'], (App, message) ->
App.module 'About.Show', (Module, App, Backbone, Marionette, $, _) ->
class Module.MessageView extends Marionette.ItemView
className: 'message-view'
tagName: 'div'
template: message我猜我需要将模板键设置为ECO模板文件,然后重写视图的呈现方法--但我不确定,因为我认为我必须首先预编译ECO文件……
我要尝试的事情:
发布于 2013-12-29 20:52:32
这里的简单答案是通过npm安装npm,然后运行类似于eco -i JST form.eco的程序。然后,将JST['form']分配给视图的template属性。手动设置多个模板可能是一项投标工作,所以最好是查看像django管道这样的东西。
https://stackoverflow.com/questions/20819644
复制相似问题