No description, website, or topics provided.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
.npmignore
README.md
package.json

README.md

RequireJS commonJS wrap middleware

Easiest way to share your modules between server and client side

Usage

Sample config

var config = {
  	baseUrl: '/js/',
	basePath: 'static/js/',
	modules: {
		'your/module/url': {
			path: 'path/to/module'
		},
		// example with dependencies mapping
		'your/another/module/url': {
			path: 'path/to/another/module',
			dependenciesMap: {
				'original/dependency/path': 'new/dependency/url'
			}
		}
	}
};

As a middleware

var app = express.createServer();
app.use(require('requirejs-common-wrap-middleware').wrapper(config));

for production at a build script:

require('requirejs-common-wrap-middleware').builder(config);

You can use the same config for wrapper and builder, but wrapper does not use basePath option, in opposite, builder does not use baseUrl option, but use basePath.