【发布时间】:2016-06-01 17:06:29
【问题描述】:
我有一个这样定义的个人资料:
var profile = {
....
layers: {
"dojo/dojo": {
include: ["dojo/main" ],
customBase: true,
boot: true
}
, "my/widget": { include: [
"my/widget/AuthorWidget",
"my/widget/templates/AuthorWidget.html" ]
}
},
....
}
这就是我想要的。它会创建文件 dojo.js 和 widget.js,其中包括我需要的所有内容。
有没有更好的方法来包含来自 my/widget 的所有文件,而不是在 include: 中列出它们? AuthorWidget.js 看起来像这样:
define([
"dojo/_base/declare",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dojo/text!./templates/AuthorWidget.html",
"dojo/dom-style",
....
所以我希望包含来自 my/widget/templates/AuthorWidget.html 的所有依赖小部件。不幸的是,我在 include: 数组中有这个文件,否则结果中不包含 dijig/form/Button。 (我在 AuthorWidget.html 中有 [button type="button" data-dojo-type="dijit/form/Button"]Click Me![/button])
我的.profile.js:
var profile = (function(){
return {
basePath: "./src",
releaseDir: "../release",
releaseName: "my",
action: "release",
defaultConfig: {
async: 1
},
packages:[{
name: "dojo",
location: "dojo"
},{
name: "dijit",
location: "dijit"
},{
name: "dojox",
location: "dojox"
},{
name: "my",
location: "../js/my",
destLocation: "myapp"
}],
layers: {
"dojo/dojo": {
include: ["dojo/main" ],
customBase: true,
boot: true
}
//this works
//, "my/widget": { include: [ "my/widget/AuthorWidget", "my/widget/templates/AuthorWidget.html" ] }
//this doesnt include Button widget required by AuthorWidget.html
, "my/widget": { include: [ "my/widget/all" ] }
},
layerOptimize: "closure",
optimize: "closure",
cssOptimize: "comments",
mini: true,
stripConsole: "warn",
selectorEngine: "lite"
};
})();
【问题讨论】: