このエントリLoading Backbone and Underscore using RequireJSに関して、Backbone固有のスクリプトとJQuery.
しかし、どうすればいいですか:
- 構成します
Twitter bootstrap.jsか? - どう
json2.jsですか?
ありがとう!
このエントリLoading Backbone and Underscore using RequireJSに関して、Backbone固有のスクリプトとJQuery.
しかし、どうすればいいですか:
Twitter bootstrap.jsか?json2.jsですか?ありがとう!
path 構成オプションについて学んだことに加えて、shim 構成オプションhttp://requirejs.org/docs/api.html#config-shimも確認する必要があります。
多くのプラグインは AMD に対応していないため、2 つのオプションがあります。シム (ほとんどのプラグインに適しています) として構成するか、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 のようなものについては、ラッパー/シムなしで、メイン アプリケーションの require の依存関係として単純にリストすることができます。