requirejs / almond

A minimal AMD API implementation for use after optimized builds
Other
2.42k stars 168 forks source link

Minimal support for browser-loaded anonymous modules #85

Closed depeele closed 10 years ago

depeele commented 10 years ago

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/ )

jrburke commented 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.