Law*_*nce 9 javascript requirejs
目前我正在使用require.js进行一个有趣的项目我正在工作一切正常,除了代码语法higlighting插件名为prism.js.我可以看到插件是通过chrome中的网络选项卡提取的,但插件没有初始化.
我不确定这是一个需求问题,或者uf插件是问题,并且想知道是否有人可以提供帮助.
这是我的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();
}
);
Run Code Online (Sandbox Code Playgroud)
Chr*_*erg 11
更改垫片部分以包括棱镜,并确保它导出"棱镜":
shim: {
"backbone": {
"deps": ["underscore", "jquery", "handlebars"],
"exports": "Backbone" //attaches "Backbone" to the window object
},
"prism": {
"exports": "Prism"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11684 次 |
| 最近记录: |