我似乎無法得到zepto與requirejs一起使用。如何使用requirejs與zepto
這裏是我的文件
main.js
require.config({
paths: {
zepto: 'libs/zepto/zepto.min',
underscore: 'libs/underscore/underscore-min',
backbone: 'libs/backbone/backbone-min',
cordova: 'libs/cordova/cordova-2.1.0',
history: 'libs/history/history',
historyZ: 'libs/history/history.adapter.zepto'
},
shim: {
zepto: {
exports: '$'
},
backbone: {
deps: ['underscore', 'zepto']
}}
});
require([
// Load our app module and pass it to our definition function
'app',
], function(App){
// The "app" dependency is passed in as "App"
App.initialize();
});
app.js
define([
'zepto',
'underscore',
'backbone',
'router' // Request router.js
], function($, _, Backbone, Router){
var initialize = function(){
// Pass in our Router module and call it's initialize function
Router.initialize();
}
return {
initialize: initialize
};
});
router.js
define([
'zepto',
'underscore',
'backbone',
'views/dashboard'
], function($, _, Backbone, DashboardView){
var AppRouter = Backbone.Router.extend({
routes: {
// Define some URL routes
'' : 'showDashboard',
}
});
var initialize = function(){
var app_router = new AppRouter;
app_router.on('showDashboard', function(){
// We have no matching route, lets just log what the URL was
//console.log('No route:', actions);
var dashboardView = new DashboardView();
dashboardView.render();
});
Backbone.history.start();
};
return {
initialize: initialize
};
});
你明白了..但是,當我運行這一切,我在Chromes con。中得到這個獨家:
GET http://localhost/SBApp/www/js/jquery.js 404 (Not Found) require.js:1824
和腳本錯誤(我在括號扔BC這wouldnt讓我發表。)
,並在Firefox使用Firebug,它吐出scripterror
任何人都有成功配置zepto與要求,可以給我一些幫助?
你用grep你的庫和來源的「jQuery的」任何提及?似乎奇怪的是,任何lib都會獨立嘗試包含它。 – numbers1311407
我做了,唯一引用jQuery的東西是需要的。我想當我嘗試使用AMD時,它會尋找它,並且我一直在環顧四周,看不到Zepto和AMD的支持嗎? –