0.6.3 • Published 11 years ago

mundle v0.6.3

Weekly downloads
-
License
-
Repository
-
Last release
11 years ago

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@version' resolves to server-side basePath/mundles/moduleName/(version|default) './some/relative/path/to/file.js' resolves to server-side basePath/some/relative/path/to/file.js

Installing mundles

	mundle install package

uses bower, so all bower packages are available here: http://sindresorhus.com/bower-components/

Defining mundles

Uses package.json with name, version, and main fields. main defaults to 'index.js' mundles are bower packages, so follow their instruction to use the centralized repo and the package dependency resolution: https://github.com/bower/bower

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

Tests

  • To run automated tests cake test
  • To run manual tests cd tests/manual node server.js * visit http://127.0.0.1:1337/ and observe console

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

0.6.3

11 years ago

0.6.2

11 years ago

0.6.1

11 years ago

0.6.0

11 years ago

0.5.0

12 years ago

0.3.0

12 years ago

0.2.3

12 years ago

0.2.2

12 years ago

0.2.1

12 years ago

0.2.0

12 years ago

0.1.0

12 years ago