使用Layer和CSS Optimization对Dojo 1.7.1进行自定义构建

时间:2012-03-06 12:29:15

标签: build dojo

使用Dojo 1.6.x,创建自定义构建非常容易。最后,我只需要包含一个dojo.js文件,我的应用程序层文件和一个包含所有样式的优化css文件。简单易行。

但是使用Dojo 1.7.x我得不到它。我的目标只是包括一个opmtimized dojo.js文件,我的应用程序层文件包含我所有的小部件和东西以及一个optmized css文件。

这是我的个人资料.js

var profile = {
releaseDir: "./release",
basePath: "..",
action: "release",
cssOptimize: "comments",
mini: true,
optimize: "closure",
layerOptimize: "closure",
stripConsole: "all",
selectorEngine: "acme",
packages:[
    {
        name: "dojo",
        location: "./sources/dojo"
    },
    {
        name: "dijit",
        location: "./sources/dijit"
    },
    {
        name: "dojox",
        location: "./sources/dojox"
    }
],
layers: {
    "dojo/dojo": {
        name: "myDojo.js",
        include: [ "dojo/dojo" ],
        boot: true,
        dependencies: [ "dojo/parser", "dojo/data/ItemFileReadStore", "dijit/themes/tundra", "dijit/Dialog", "dijit/form/Form", "dijit/form/Button", "dijit/form/CheckBox", "dijit/form/ComboBox", "dijit/form/DateTextBox", "dijit/form/FilteringSelect", "dijit/form/NumberSpinner", "dijit/form/Textarea", "dijit/form/TextBox", "dijit/form/TimeTextBox", "dijit/form/ValidationTextBox", "dijit/layout/ContentPane", "dijit/layout/TabContainer", "dijit/Tooltip", "dojox/widget/ColorPicker" ]
    }
},
resourceTags: {
    amd: function (filename, mid) {
        return /\.js$/.test(filename);
    }
}

};

当我运行构建时,会创建一个版本。我发现dojo.js的大小约为580 KB未压缩。但我并不喜欢我的应用程序文件和所有样式的压缩css文件。

我做错了什么?

谢谢,拉尔夫

1 个答案:

答案 0 :(得分:1)

您的图层规范似乎不正确。试试这个:

layers: {
    "dojo/myDojo": {
        include: [ "dojo/parser", "dojo/data/ItemFileReadStore",
                   "dijit/themes/tundra", "dijit/Dialog", "dijit/form/Form",
                   "dijit/form/Button", "dijit/form/CheckBox",
                   "dijit/form/ComboBox", "dijit/form/DateTextBox",
                   "dijit/form/FilteringSelect", "dijit/form/NumberSpinner",
                   "dijit/form/Textarea", "dijit/form/TextBox",
                   "dijit/form/TimeTextBox", "dijit/form/ValidationTextBox",
                   "dijit/layout/ContentPane", "dijit/layout/TabContainer",
                   "dijit/Tooltip", "dojox/widget/ColorPicker"
                 ],
        boot: true
    }
},

<强>参考