A browser based commonjs module 1.0 compliant module loader.
- commonjs modules 1.0 compliance (same as node)
- node_module support
- need a module simply
npm install
and require it in your code
- need a module simply
- folder modules
- either index.js or main script in package.json are used
- cross browser
- chrome -> Yes
- firefox -> Yes
- safari -> Yes
- opera -> Yes
- IE 9 -> Yes
- IE 8 -> Yes
- sandboxing modules from browser environment
var document = require('document');
- simple syntax
- A file is treated as a module and the only things exposed from the file is done explicitly through its exports
exports.awesomeFunctionality = ...
Download the source file (src/commun.js) and include it in your html as shown below
<script data-main="main.js" src="commun.js"></script>
where main.js is something like
var document = require('document');
var history = require('history');
var awesomeModule = require('something/like/this')
awesomeModule.be()
git clone [email protected]:gingermusketeer/commun.js.git
cd commun.js
npm install
node serve
visit localhost:8080
Have a look at the source code in the example directory.
In lieu of a formal style-guide, take care to maintain the existing coding style. Add Jasmine tests for any new or changed functionality. Lint and test your code using grunt.
acorn.js powers the parser used to detect syntax errors when a script fails to load.
Copyright (c) 2013 Max Brosnahan Licensed under the MIT license.