現在、楽しいサイドプロジェクトにrequire.jsを使用しています。prisme.jsと呼ばれるコード構文のハイライトプラグインを除いて、すべてが正常に機能しています。プラグインがChromeのネットワークタブを介してプルされていることがわかりますが、プラグインは初期化されていません。
それがrequireの問題なのか、それともプラグインが問題なのかわからないので、誰か助けてくれないかと思っていました。
これが私のmain.jsの外観です:
require.config({
// 3rd party script alias names
paths: {
// Core Libraries
modernizr: "libs/modernizr",
jquery: "libs/jquery",
underscore: "libs/lodash",
backbone: "libs/backbone",
handlebars: "libs/handlebars",
text: "libs/text",
prism: "plugins/prism",
templates: "../templates"
},
// Sets the configuration for your third party scripts that are not AMD compatible
shim: {
"backbone": {
"deps": ["underscore", "jquery", "handlebars"],
"exports": "Backbone" //attaches "Backbone" to the window object
}
}
});
// Include Specific JavaScript
require(['prism', 'modernizr', 'jquery', 'backbone', 'routers/router', 'views/AppVIew' ],
function(Prism, Modernizr, $, Backbone, Router, App) {
this.router = new Router();
this.App = new App();
}
);