Last active
February 12, 2024 00:38
-
-
Save unscriptable/4557754 to your computer and use it in GitHub Desktop.
run.js versus main module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The bootstrap for the app is a module. The weird thing about this option | |
* is that it uses curl(), rather than require(), inside the module to load | |
* other modules, such as the app's main module. | |
* The script element to execute this bootstrap would look like this: | |
* | |
* <script data-main="client/run-module" src="client/lib/curl.js"></script> | |
*/ | |
define(['curl'], function (curl) { | |
var config = { | |
baseUrl: 'client', | |
paths: { | |
theme: 'theme', | |
curl: 'lib/curl/src/curl', | |
app: 'app' | |
}, | |
pluginPath: 'curl/plugin', | |
packages: [ | |
{ name: 'wire', location: 'lib/wire', main: 'wire' }, | |
{ name: 'when', location: 'lib/when', main: 'when' }, | |
{ name: 'meld', location: 'lib/meld', main: 'meld' }, | |
{ name: 'cola', location: 'lib/cola', main: 'cola' }, | |
{ name: 'poly', location: 'lib/poly', main: 'poly' } | |
], | |
preloads: ['poly/string', 'poly/array'] | |
}; | |
curl(config, ['wire!app/main']); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The bootstrap for the app is a script. The weird thing about this option | |
* is that it must be specified in the data-main as a legacy script. | |
* The script element to execute this bootstrap would look like this: | |
* | |
* <script data-main="js!client/run-script.js" src="client/lib/curl.js"></script> | |
*/ | |
(function( curl ) { | |
var config = { | |
baseUrl: 'client', | |
paths: { | |
theme: 'theme', | |
curl: 'lib/curl/src/curl', | |
app: 'app' | |
}, | |
pluginPath: 'curl/plugin', | |
packages: [ | |
{ name: 'wire', location: 'lib/wire', main: 'wire' }, | |
{ name: 'when', location: 'lib/when', main: 'when' }, | |
{ name: 'meld', location: 'lib/meld', main: 'meld' }, | |
{ name: 'cola', location: 'lib/cola', main: 'cola' }, | |
{ name: 'poly', location: 'lib/poly', main: 'poly' } | |
], | |
preloads: ['poly/string', 'poly/array'] | |
}; | |
curl(config, ['wire!app/main']); | |
})( curl ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment