Last active
August 29, 2015 13:56
-
-
Save heyarne/8925413 to your computer and use it in GitHub Desktop.
Basic setup for using Curl.js to load commonjs modules; useful for testing modules written for browserify. Used modules can be installed with `bower install`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Curljs cjsm11 setup", | |
"private": true, | |
"dependencies": { | |
"chai": "~1.8.0", | |
"mocha": "~1.14.0", | |
"curl": "~0.8.8", | |
"backbone": "~1.1.0", | |
"zepto": "~1.1.2", | |
"lodash": "~2.4.1" | |
}, | |
"devDependencies": {} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Mocha Spec Runner</title> | |
<link rel="stylesheet" href="bower_components/mocha/mocha.css"> | |
</head> | |
<body> | |
<div id="mocha"></div> | |
<!-- libraries --> | |
<script src="bower_components/mocha/mocha.js"></script> | |
<script>mocha.setup('bdd')</script> | |
<script src="bower_components/chai/chai.js"></script> | |
<script src="bower_components/zepto/zepto.min.js"></script> | |
<script> | |
assert = chai.assert, expect = chai.expect, should = chai.should() | |
curl = { | |
paths: { | |
curl: 'bower_components/curl/src/curl/' | |
}, | |
packages: { | |
backbone: { | |
location: 'bower_components/backbone/', | |
main: 'backbone-min', | |
config: { loader: 'curl/loader/cjsm11' } | |
}, | |
underscore: { | |
location: 'bower_components/lodash/dist/', | |
main: 'lodash.underscore.min' | |
}, | |
scripts: { | |
location: '.', | |
config: { loader: 'curl/loader/cjsm11' } | |
} | |
} | |
} | |
</script> | |
<script src="bower_components/curl/src/curl.js"></script> | |
<!-- loading tests --> | |
<script> | |
var debug = function() { | |
console.error(arguments[0].stack) | |
debugger | |
} | |
// because scripts is defined as a package above, curjs is loading ./navi with the cjsm11 loader | |
// Loader docs: https://github.com/cujojs/curl/blob/master/src/curl/loader/README.md | |
curl(['scripts/navi']).then(function(tags) { | |
debugger | |
mocha.run() | |
}, debug) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment