requirejs、backbone.js配置

愛六六發表於2014-05-11

requirejs初探

參考資料
官網:http://requirejs.org
中文譯文:http://makingmobile.org/docs/tools/requirejs-api-zh

reuqirejs、backbone的配置例子

(function(){
    require.config({
        baseUrl: "../js",
        paths: {
            jquery: "libs/jquery.min",
            underscore: "libs/underscore.min",
            backbone: "libs/backbone.min",
            localstorage: "libs/localStorage"
        },
        shim: {
            underscore: {exports: "_"},
            backbone: {
                deps: ["underscore","jquery"],
                exports: "Backbone"
            }
        }
    });

    require(["mbase","dotos"],function(mbase,doto){
        mbase.mbase.loadCss("../css/dotos.css");
        $(function(){
            doto.run();
        });
    });
})();

 


相關文章