2014-02-28 68 views
1

我是Yeoman的新手,我正在使用官方Backbone生成器創建一個新項目。我已經使用命令加入jQuery Mobile的:將jQuery Mobile添加到Yeoman Backbone項目

bower install -save jquery-mobile 

當我運行應用程序,require.js我所有的jQuery的移動腳本失蹤報告。我已閱讀這篇文章herehere。我必須錯過一步,或讓我的main.js設置錯誤。

這裏是我main.js的相關部分:

require.config({ 
    shim: { 
     <...> 
     jquerymobileconfig: { 
     deps: [ 
      'jquery' 
     ] 
     }, 
     jquerymobile: { 
     deps: [ 
      'jquery', 
      'jquerymobileconfig' 
     ] 
     } 
    }, 
    paths: { 
    jquery: '../bower_components/jquery/jquery', 
    jquerymobileconfig: 'jqmconfig', 
    jquerymobile: '../bower_components/jquery-mobile/js/jquery.mobile', 
    backbone: '../bower_components/backbone/backbone', 
    underscore: '../bower_components/underscore/underscore' 
    } 
}); 

require([ 
    'jquery', 'backbone', 'jquerymobile' 
], function ($, Backbone) { 
    Backbone.history.start(); 
}); 

回答

1

我找到了答案,我的問題here。而不是安裝涼亭的jQuery移動項目,安裝:

bower install -save jquery-mobile-bower 

這是準備去的jQuery移動的版本亭子/約曼項目。然後在main.js中引用jquery mobile爲:

jquerymobile: '../bower_components/jquery-mobile-bower/js/jquery.mobile-1.4.1.min',