<global ScriptMain="'main'" type="string" />
An example of another page using this master page overriding that main script:
Example.spark (for an ExampleViewModel, normal route that serves a view):
<set ScriptMain="'example-main'" />
contents of example-main.js
require(['main',
'data-module',
'dependencies',
'get',
'listed',
'here'],
function () {
});
"main" in the above dependency list is the file you would normally think of as data-main for require.js, it contains all the boilerplate glue for the site.
The reason we include these intermediary files that list all the dependencies for a page stems from our use of "data-module" attributes which we use require.js to fetch (I believe Dovetail is doing this as well), but when you do something like that require no longer knows about those as dependencies which prevents the require optimizer tool from compressing/obfuscating them accurately.
This is another area where the asset pipeline could (and probably should) be doing this work instead, but we would need to register these 'data-module' dependencies with the asset pipeline somehow.
I spiked out some stuff (using IAssetPrecompiler) to parse it out of your require modules dependency list but that would only work if you manually listed them like we did above with our additional main files, maybe we can come up with something more clever in the future.
I would also like to see us make the use of 'data-module' an official part of something like a FubuMVC.RequireJs bottle sometime if that is feasible since I feel there is a lot of value in using that approach.