refactor(angular): externalize script load order into JSON

- move all script load order into angularFiles.js
- rakefile and angular-bootstrap.js use angularFiles.js to get script orders
- gen_jstd_configs.js uses angularFiles.js to generate various jstd config files
- run gen_jstd_configs.js whenever we run server.sh

Closes #470
This commit is contained in:
Di Peng
2011-08-15 16:17:12 -07:00
committed by Igor Minar
parent 8017340cd1
commit a13653c814
11 changed files with 197 additions and 359 deletions

View File

@@ -64,7 +64,10 @@
}
};
function addScripts(){
window.addScripts = function(scripts) {
delete window.addScripts;
delete window.angularFiles;
var prop, i;
// initialize the window property cache
@@ -75,8 +78,8 @@
}
// load the js scripts
for (i in Array.prototype.slice.call(arguments, 0)) {
var file = arguments[i];
for (i in scripts) {
var file = scripts[i].replace(/src\//, '');
document.write('<script type="text/javascript" src="' + serverPath + file + '" ' +
'onload="angularClobberTest(\'' + file + '\')"></script>');
}
@@ -89,48 +92,8 @@
addCss('angular.css');
addScripts('Angular.js',
'JSON.js',
'Compiler.js',
'Scope.js',
'Injector.js',
'jqLite.js',
'parser.js',
'Resource.js',
'Browser.js',
'sanitizer.js',
'AngularPublic.js',
// Extension points
'service/cookieStore.js',
'service/cookies.js',
'service/defer.js',
'service/document.js',
'service/exceptionHandler.js',
'service/hover.js',
'service/invalidWidgets.js',
'service/location.js',
'service/log.js',
'service/resource.js',
'service/route.js',
'service/routeParams.js',
'service/sniffer.js',
'service/window.js',
'service/xhr.bulk.js',
'service/xhr.cache.js',
'service/xhr.error.js',
'service/xhr.js',
'service/locale.js',
'apis.js',
'filters.js',
'formatters.js',
'validators.js',
'directives.js',
'markups.js',
'widgets.js');
document.write('<script type="text/javascript" src="' + serverPath + '../angularFiles.js' + '" ' +
'onload="addScripts(angularFiles.angularSrc)"></script>');
function onLoadListener(){
// empty the cache to prevent mem leaks