0

我正在构建dojo 1.8.3,其配置文件将所有dojo 和我自己的AMD 代码放在一个层中。我还想在同一个文件中包含一些非 AMD 库(例如 history.js)和 polyfill,原样。是否可以使用 dojo 构建系统来做到这一点?

当前的构建配置文件:

var profile = (function () {
var conf = {
    basePath: ".",
    layerOptimize: "closure",
    optimize: "closure",
    cssOptimize: "comments",
    mini: true,
    selectorEngine: "acme",

    defaultConfig: {
        hasCache: {
            "dojo-built": 1,
            "dojo-loader": 1,
            "dom": 1,
            "host-browser": 1,
            "config-selectorEngine": "acme"
        },
        async: 1
    },

    packages: [{
        name: "dojo",
        location: "./dojo"
    }, {
        name: "dijit",
        location: "./dijit"
    }, {
        name: "dojox",
        location: "./dojox"
    }, {
        name: "MyApp",
        location: "./MyApp"
    }, {
        name: "bootstrap",
        location: "./bootstrap"
    }],

    layers: {
        "dojo": {
            name: "dojo",
            include: [
                "dojo/dojo",
                "dojo/domReady",
                "MyApp/common",
                "MyApp/bootstrap"
            ]
        }
    }
}
return conf;
}());
4

1 回答 1

1

如果您将文件添加为一个包,dojo 将自动包装它们并包含它们。我将此添加到包部分:

{
    name: "libs",
    location: "./libs"
}

并将图层定义更改为:

"dojo": {
     name: "dojo",
     include: [
         "dojo/dojo",
         "dojo/domReady",
         "libs/history/native.history",
         "libs/base64/base64",
         "MyApp/common",
         "MyApp/bootstrap"
     ]
 }    

(base64 和 native.history 是普通的 Javascript 库)

于 2013-04-29T04:17:10.257 回答