in ox dev loader, allow for switching to build version by passing true as first argument (can be used to avoid boilerplate when choosing build/ or dev/ dynamically)

This commit is contained in:
rolux 2012-06-26 19:17:27 +02:00
parent 2efbc53b33
commit 80e0a02ea3

View file

@ -11,6 +11,13 @@
path = getPath(), path = getPath(),
time = +new Date(); time = +new Date();
if (args[0] === true) {
console.log('OK')
path = path.replace(/dev\/$/, 'build/');
loadScript('Ox.js', function() {
Ox.load.apply(null, Ox.slice(args, 1));
});
} else {
loadJSON(function(data) { loadJSON(function(data) {
var previousOx = global.Ox; var previousOx = global.Ox;
loadScriptsSerial(data.files, function() { loadScriptsSerial(data.files, function() {
@ -23,6 +30,7 @@
Ox.load.apply(null, args); Ox.load.apply(null, args);
}); });
}); });
}
function getPath() { function getPath() {
var i, path, scripts = document.getElementsByTagName('script'); var i, path, scripts = document.getElementsByTagName('script');