Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Client-side module bundler, cacher, loader
C CoffeeScript JavaScript
Branch: master
Pull request Compare This branch is 45 commits behind meelash:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
src
tests
.gitignore
COPYING
Cakefile
README.mdown
package.json

README.mdown

Mundlejs

Module bundler, cacher, and client-side loader
Demonstration:

Installation

npm install mundle

Basic Usage

Server-side

serverRequire = require('mundle');
serverRequire.setBasePath('pathToMakeIntoTheClient-sideRoot');
serverRequire.listen(3000);

Server-side using Connect(/Express)

connect = require('connect');
mundle = require('mundle');
app = connect()
  .use(mundle.connect('pathToMakeIntoTheClient-sideRoot')
  .listen(3000);

Client-side

<script type='text/javascript' src='mundlejs/require.js'></script>
<script type='text/javascript'>
    require('somePath',function(error,exportsFromSomePath){
        console.log('Yayyy!');
    };
</script>
  • somePath can be
    • 'moduleName' resolves to server-side basePath/moduleName.js
    • './some/relative/path/to/file.js' resolves to server-side basePath/some/relative/path/to/file.js

Plugins

plugin = require(plugin);
mundle.use(plugin);

or

plugin1 = require(plugin1);
plugin2 = require(plugin2);
mundle.use([plugin1, plugin2]);
  • plugins allow you to pre-compile files before mundle attempts to parse them
    • e.g. Jade template files, for including pre-compiled client-side, or coffee
  • plugins look like: {extensions: [an array of file extensions, e.g. 'coffee', 'jade']}
  • check my other repos for jade and coffeescript plugins very shortly

Tests

  • To run automated tests cake test
  • To run manual tests
    cd tests/manual
    node server.js

Contribute

  • Suggestions of how to make this more useful/robust/pluginable/available to more people very welcome
  • Improve compatibility with Commonjs module specification
  • Performance
  • Bug reports
  • Pull requests
  • Can this be generalized, for example automatic optimization of spriting from css files?
  • Plugins for processing files? e.g. compile jade templates
  • Check out the issues for ideas on what you can implement

Coming soon

  • https (might already be working ;) untested)
  • more tests (especially client-side)
  • cacheing
    • client-side
    • cdn
      • have some ideas about cacheing to cdn's for really great performance
  • check out the issues for more

Blog posts

Copyright (C) 2012 Saleem Abdul Hamid
Licensed under the GPL license

Something went wrong with that request. Please try again.