Closed depeele closed 10 years ago
Thanks for taking the time to do a pull request. However, almond is designed to only be used for modules that have been combined together using an AMD-aware concatenator, like the r.js optimizer, which will name the modules.
If you feel strongly that you need this type of capability, feel free to maintain a fork, and you can list it on the AMD API shims page.
With these small changes almond.js can provide minimal support for browser-loaded anonymous modules.
Anonymous modules (e.g. lodash.js, when.js) expect to be named through path mapping. In this case, a name may be determined at run-time if we're in the browser and the script is being synchronously loaded via the <script> tag. In this case, we're guaranteed that the currently executing script is the last one in the current DOM -- in fact, it should be the last DOM element (ref http://ejohn.org/blog/degrading-script-tags/ )