Experimental builder for bundling AMD modules into single file.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
.gitignore
.jshintrc
Gruntfile.js
README.md
index.js
package.json

README.md

rbind

Experimental builder for bundling AMD modules into single file. It uses r.js to collect dependencies and replaces define and require in the code by static referrences. Right now it works only with explicitly require'd dependencies:

define([

  'require',
  'another-file'

], function(require) {

  var another = require('another-file');

});

Usage

> npm install rbind -g
> rbind --profile=mylib 

This would generate ./mylib.js containing modules listed in ./mylib. Profile uses following format:

func1   path/to/func1
func2   path/to/func2
...
funcN   path/to/funcN

By default modules dir is ./src and can be changed with --src. Run rbind -h to find more options.

You may also use it as node module:

var rbind = require('rbind');

rbind({
    src       : './src',
    dist      : './dist/sample.js',
    name      : 'sample',
    profile   : {
        intro: 'intro'
    },
    requirejs : {
      // legit requirejs.optimize() options
    }
});

Generated bundle would be wrapped and (function(){ ... }()); and define window.%name% variable. Also it contains %name%.noConflict().