Skip to content

Instantly share code, notes, and snippets.

@jrburke
Last active February 11, 2024 23:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrburke/7896791 to your computer and use it in GitHub Desktop.
Save jrburke/7896791 to your computer and use it in GitHub Desktop.
Manual main switching
// For any third party dependencies, like jQuery, place them in the lib folder.
// Configure loading modules from the lib directory,
// except for 'app' ones, which are in a sibling
// directory.
requirejs.config({
baseUrl: 'lib',
paths: {
app: '../app'
}
});
var main = 'app/main',
scriptNode = document.querySelector('[data-postmain]');
if (scriptNode) {
main = scriptNode.dataSet.postmain;
}
requirejs([main]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment