使用require.js与Twitter自举API和骨干 [英] Using require.js with Twitter Boostrap API and backbone

查看:151
本文介绍了使用require.js与Twitter自举API和骨干的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于此条<一个href=\"http://stackoverflow.com/questions/8131265/loading-backbone-and-underscore-using-requirejs/8156341#8156341\">Loading骨干,并强调使用requirejs 的很清楚我我怎么配置骨干特异性脚本和 JQuery的

Regarding this entry Loading backbone and underscore using requirejs it is quite clear to me how do I configure Backbone-specific scripts and JQuery.

但我怎么


  • 配置微博bootstrap.js

  • 怎么样 json2.js

  • configure Twitter bootstrap.js?
  • what about json2.js?

谢谢!

推荐答案

另外,您了解的路径配置选项是什么,你还应该检查垫片配置选项<一个href=\"http://requirejs.org/docs/api.html#config-shim\">http://requirejs.org/docs/api.html#config-shim.

In addition to what you learned about the path config option, you should also review the shim config option http://requirejs.org/docs/api.html#config-shim.

许多插件没有准备好AMD。无论其配置为垫片(适用于大多数的插件),或在 https://github.com/amdjs

Many plugins are not AMD ready so you have two options. Either configure it as a shim (suitable for most plugins), or write your own adapters like the efforts at https://github.com/amdjs

简单的例子:

require.config({
    shim: {
        'bootstrap': ['jquery'], // no exports
        'underscore': { exports: '_' }, // no dependencies
        'backbone.layoutmanager': {
            deps: ['backbone']
            exports: 'Backbone.LayoutManager'
        } // a mix of exports and dependencies
     }
});

有关类似json2它没有依赖关系,并只激活如果浏览器不具有本机实现,你可以简单地将其列为主应用程序的需要不带包装/垫片的依赖关系。

For something like json2 which has no dependencies and only activates if the browser has no native implementation, you can simply list it as a dependency of your main application's require without a wrapper / shim.

这篇关于使用require.js与Twitter自举API和骨干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆