forked from supnate/dojos
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.js
39 lines (33 loc) · 1.08 KB
/
bootstrap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var path = require('path');
var dojosroot = path.dirname(module.filename);
var dojoroot = path.join(dojosroot, '../dojo');
global.dojoConfig = {
packages:[{
name: 'dojos'
,location: '../dojos'
}]
,deps: ['dojos/main']
,baseUrl: dojoroot
};
global.dojosConfig = require('./config');
global.dojosConfig.sites.forEach(function(site){
if(!site.id)site.id = 'site_' + Math.random().substring(2);
if(/^\./.test(site.location)){
//resolve relative path
site.location = path.join(dojosroot, site.location);
}
site.location = site.location.replace(/\\/g, '/');
if(!/\/$/.test(site.location))site.location += '/';
if(/\s/.test(site.id)){
console.log('Site name is the identifier of a site, it should not include any blank charater, use title property for display name instead');
}else{
//Each configured site is a package for dojo
global.dojoConfig.packages.push({
name: site.id
,location: site.location
});
}
});
//Hack for a dojox/dtl defect: should not depend on window object in no-browser environment.
global.window = global;
require(path.join(dojoroot, 'dojo.js'));