run.js 1.08 KB
(function () {
    var defaultTheme = '-default';

    var initRequireConfig = function() {

        require(["amdConfig"],function (config) {

        var newConfig = { paths: {} };

        // 处理service页面css配置
        Object.keys(config.paths).filter(function(key) {
            var path = config.paths[key];

            return ~key.indexOf('_css') && ~path.indexOf("css/service/");
        }).forEach(function(key) {
            var serviceId = key.replace(/(mService\/|_css)/g, '');

            newConfig.paths[key] = "css/service/service." + serviceId + defaultTheme;
        });
        // 处理common和插件css配置
        Object.keys(config.paths).forEach(function(modName) {
            var relPath = config.paths[modName];

            if (~modName.indexOf('_css') && (~relPath.indexOf('css/common') || ~relPath.indexOf('css/component'))) {
                newConfig.paths[modName] = relPath + defaultTheme;
            }
        });
        require(newConfig);
        window.amdConfig = null;
        });
    };

    initRequireConfig();
    require(["main_demo"]);
}());