UNPKG

curl-amd

Version:

curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.

58 lines (46 loc) 1.41 kB
<!DOCTYPE HTML> <html> <head> <title>test jquery convenience build</title> <script> curl = { paths: { curl: '../src/curl/', cjs: { location: 'support/commonjs', config: { loader: 'curl/loader/cjsm11' } } } }; </script> <script src="../dist/curl-for-jQuery/curl.js"></script> <script type="text/javascript"> curl( [ 'stuff/three', 'css!stuff/base', 'text!stuff/template.html', 'js!stuff/plain_old.js!exports=testDomain.foo', 'cjs/nakedDependentCjsm1.1' ] ).then( function (three, link, template, script, cjs1) { (three == 3 ? success : failure)('A module with dependencies loaded.'); (typeof template == 'string' && template.length ? success : failure)('text resource loaded.'); (script ? success : failure)('A script loaded with the js! plugin.'); (cjs1.stuff === 'stuff' ? success : failure)('A module loaded via cjsm11 loader extension.'); } ); function write (msg) { curl(['domReady!'], function () { document.body.appendChild(document.createElement('div')).innerHTML = msg; }); } function failure (msg) { write('FAILED: ' + msg); } function success (msg) { write('SUCCESS: ' + msg); } </script> </head> <body> <p>This text should all be the same <span style="color: #2faced;">color</span> if the css file loaded.</p> </body> </html>