2

Using yeoman init backbone:all generates the required files for a sample Backbone.JS app. Along with the MVC files for a sample application object, it also creates a folder at bbapp/app/scripts/templates with a sample ejs file called application.ejs. The Backbone View file for the sample application has a line (which is commented out):

//template: application

Uncommenting this does not work. It tries to look for an object with the name 'application' and throws an error: Uncaught ReferenceError: application is not defined. Using yeoman init bbb creates the Backbone Layout Manager which probably does the trick. Any ideas how I can use EJS files for templating in a project generated with yeoman init backbone:all ?

Thanks!

4

1 回答 1

0

到目前为止,yeoman 1.0 的generator-backbone还没有正式发布,但是你可以这样尝试

今天我提出了一个预编译 ejs 模板的修复方法。

该修复程序会将app/templates中的所有*.ejs文件预编译为app/scripts/templates.js。一旦修复合并到主服务器并且生成器正式发布,将更新。

PS:在 yeoman 1.0beta 中使用yo backbone:all而不是yeoman init backbone:all

于 2013-04-02T15:30:47.243 回答