Skip to content

Instantly share code, notes, and snippets.

@kylebakerio
Created April 6, 2017 03:43
Show Gist options
  • Save kylebakerio/e98be0a3f30cc62a187dd2371ae3e673 to your computer and use it in GitHub Desktop.
Save kylebakerio/e98be0a3f30cc62a187dd2371ae3e673 to your computer and use it in GitHub Desktop.
non working example (putting all scripts through lab.js)
<html>
<body ng-app="mapmycustomersApp" ng-strict-di>
<!-- FB Analytics for Web -->
<script>
// stuff
</script>
<!--[if lte IE 8]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!-- Loading, spinning GIF -->
<div id="loadingGif" class="loading">Loading&#8230;</div>
<!--Modal BG-->
<div id="modalbg" class="modalbg"></div>
<!-- Template -->
<div ng-view id="ngViewContainer"></div>
<!-- Google Analytics -->
<script>
// stuff
</script>
<script src="build/libraries/LAB.min.js"></script>
<script type="text/javascript">
// don't worry about this part
document.write('<script src="https://maps.googleapis.com/maps/api/js?libraries=visualization,geometry,places"><\/script>');
</script>
</script>
<!--
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/parse/1.6.14/parse.min.js"></script>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap-wizard/1.2/jquery.bootstrap.wizard.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/min/dropzone.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.full.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.5.1/lodash.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.32/angular.min.js"></script>
<script src="https://code.angularjs.org/1.2.32/angular-resource.min.js"></script>
<script src="https://code.angularjs.org/1.2.32/angular-route.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ngStorage/0.3.11/ngStorage.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/croppie/2.4.0/croppie.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/shepherd/1.8.1/js/shepherd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/6.4.2/sweetalert2.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/4.1.4/papaparse.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chartist/0.9.4/chartist.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jvectormap/2.0.4/jquery-jvectormap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mouse0270-bootstrap-notify/3.1.7/bootstrap-notify.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.5.0-beta4/html2canvas.min.js"></script>
<script src=""></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.1.2/ui-bootstrap-tpls.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.45/js/bootstrap-datetimepicker.min.js"></script>
<script src="scripts/internal/calendar-API-gapi-Auth.js"></script>
<script src="https://apis.google.com/js/client.js?onload=gapiAuthorize"></script>
<script src='build/libraries/maplabel.min.js'></script>
<script src='build/libraries/markerclusterer.min.js'></script>
<script src='build/libraries/amcharts.min.js'></script>
<script src='build/libraries/serial.min.js'></script>
<script src='build/libraries/angular-routing.min.js'></script>
<script src='build/libraries/ng-file-upload-all.min.js'></script> -->
<script>
var externalLibraries = [
"https://cdn.polyfill.io/v2/polyfill.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/parse/1.6.14/parse.min.js",
"https://code.jquery.com/jquery-2.2.4.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap-wizard/1.2/jquery.bootstrap.wizard.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/min/dropzone.min.js",
"https://code.jquery.com/ui/1.12.1/jquery-ui.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.full.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.5.1/lodash.min.js",
"https://ajax.googleapis.com/ajax/libs/angularjs/1.2.32/angular.min.js",
"https://code.angularjs.org/1.2.32/angular-resource.min.js",
"https://code.angularjs.org/1.2.32/angular-route.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/ngStorage/0.3.11/ngStorage.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/croppie/2.4.0/croppie.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/shepherd/1.8.1/js/shepherd.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/6.4.2/sweetalert2.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/PapaParse/4.1.4/papaparse.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/chartist/0.9.4/chartist.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/jvectormap/2.0.4/jquery-jvectormap.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/mouse0270-bootstrap-notify/3.1.7/bootstrap-notify.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.5.0-beta4/html2canvas.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.1.2/ui-bootstrap-tpls.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.45/js/bootstrap-datetimepicker.min.js",
"build/internal/calendar-API-gapi-Auth.min.js",
"https://apis.google.com/js/client.js?onload=gapiAuthorize",
];
var internalLibraries = [
// libraries
'build/libraries/maplabel.min.js', // another google script, didn't see cdn -->
'build/libraries/markerclusterer.min.js', // unable to find reliable single source -->
'build/libraries/amcharts.min.js', // many files, + our file doesn't have version# -->
'build/libraries/serial.min.js', // don't know what it is, no version or info -->
'build/libraries/angular-routing.min.js', // very old, rarely used, no CDN -->
'build/libraries/ng-file-upload-all.min.js', // if this works, can switch to CDN @ https://cdnjs.cloudflare.com/ajax/libs/danialfarid-angular-file-upload/12.2.13/ng-file-upload-all.min.js -->
// note: cookies libary not used
// note: fullcalendar is used elsewhere in app
// note: lab is sourced directly outside of here in order to make this script work
];
var internalSources = [
// internal modules
'internal/development-utils',
'internal/Gmaps-utils',
'internal/csv-import-module',
// controllers
'app',
'controllers/login',
'controllers/register',
'controllers/teams',
'controllers/main',
];
var inProd = window.theEnvironment === 'production';
var LABsettings = {
CacheBust: !inProd,
AlwaysPreserveOrder: false,
};
$LAB.setGlobalDefaults(LABsettings);
internalSources = internalSources.map(function(source) {
return inProd ? 'build/' + source + ".min.js" : "scripts/" + source + ".js";
});
var allScriptsOrdered = externalLibraries.concat(internalLibraries).concat(internalSources);
console.log("scripts:", allScriptsOrdered);
allScriptsOrdered
// for some reason, angular seems to try to init before mapmycustomersApp is declared. :/
.reduce(function(LABcall, source) {
return LABcall.script(source);
}, $LAB);
// .forEach(function(source) {
// document.write("<script src='" + source + "'><\/script>")
// });
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment