So far the top level object (called 'I' at this point) keeps a hash of
provides, requires, and what has already been written to the page.
So,
"I.require('carousel');"
would result in a tag like,
<script type="text/cjs" cjssrc="now/plugins/carousel.js"></script>.
If you had a directory named plugins with the file carousel.js in your
source directory.
I have a Node.js program about 1/2 the way done that scans your source
directory (like 'scripts/')
and writes a file (think Closure's calcDeps.py) depending on what it
finds, for example if your folders were like so:
scripts/
---control.js
---i.js
---now/
---jquery.js
---plugins/
---carousel.js
---later/
---foo.js
A dependency file would be written containing calls to
I.addDependency() like,
I.addDependency('scripts/now/jquery.js', 'jquery', false);
I.addDependency('scripts/now/plugins/carousel.js', 'carousel', false);
I.addDependency('scripts/later/foo.js', 'foo', true);
which would cause the tags:
<script type="text/cjs" cjssrc="scripts/now/jquery.js"></script>
<script type="text/cjs" cjssrc="scripts/now/plugins/carousel.js"></
script>
<script type="text/cjs" cjssrc="scripts/later/foo.js" cjsexec=false></
script>
to be rendered
the now/ and later/ directories are being used to tell the node.js
depWriter program
if the bool for cjsexec should be set or not.
The i.js file should only be a few k when minified, looks like its
around 90 lines @ about 90% done.
ATM I am loading it blocking, it then writes the async script to fetch
control.js then checks the dependency file