Howto bootstrap Backbone app with yeoman having require.js enabled

与世无争的帅哥 提交于 2019-12-08 17:40:02

问题


I'm playing with yeoman for a time now. I wonder how I accomplish bootstrapping a Backbone application and having require.js enabled at the same time.

yeoman init

provides me with a setup where I can work with modules in AMD style.

yeoman init backbone:all

provides me with a Backbone scaffold but I had to "include" all my models, collection etc. manually in index.html.

Is there a way to have both?

Regards Felix


回答1:


There's already an open issue for this. Add your thoughts there :)




回答2:


We have updated the Yeoman backbone generator to support RequireJS. But it not officially added to npm. But you can try it using

npm install git://github.com/yeoman/generator-backbone.git

Discussion : Not found in npm install

The backbone generator supports yeoman 1.0beta. Try

yo backbone

You will receive a conditional prompt for RequireJS.

UPDATE 1

Backbone generartor is available on npm.
Try npm install generator-backbone

UPDATE 2
RequireJS with --coffee option is now supported in backbone generator v0.2.2




回答3:


Hi I developed a generator for that, take a look at https://github.com/abiee/generator-backbone-amd




回答4:


I was trying the same today. What I did ultimately was to perform yeoman init first. Then again yeoman install backbone. Console will ask if you want to override files. Do not override main.js & index.html. Rest you may.

This won't give you perfect start. But, most of the things will be in place.



来源:https://stackoverflow.com/questions/13153359/howto-bootstrap-backbone-app-with-yeoman-having-require-js-enabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!