Skip to content

Instantly share code, notes, and snippets.

@dtothefp
Created September 5, 2015 19:14
Show Gist options
  • Select an option

  • Save dtothefp/1da0fcc9787f4a5615dd to your computer and use it in GitHub Desktop.

Select an option

Save dtothefp/1da0fcc9787f4a5615dd to your computer and use it in GitHub Desktop.
import 'script!history.js/scripts/bundled/html4+html5/jquery.history';
import 'script!jquery.cookie';
/**
* These function calls bootstrap all of the global files, essentially requiring them in
* to mimic concat behavior. This is a temporary solution until we begin `require`ing utilities
* into page level JS rather than referencing them as globals.
* RegEx excludes files that have already been required in a specific order or those that should be omitted.
*
*/
const allGlobals = [
require.context('./utils', false, /^(?!\.\/form-filler\.js).*\.js$/),
require.context('./utils/form_helpers', false, /\.js$/),
require.context('./globals', false, /\.js$/),
require.context('./components', false, /\.js$/),
require.context('./services', false, /^(?!\.\/user_state\.js).*\.js$/)
];
var each = function(arr, fn) {
for(var i=0; i < arr.length; i+=1) {
fn(arr[i], i);
}
};
each(allGlobals, (context) => {
if (typeof context.keys === 'function') {
each(context.keys(), context);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment