Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including builder-amd with all npm packages installed. Try it out:

var builderAmd = require("builder-amd")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

builder-amd v0.0.3

Why builder-amd?

Use builder-amd to generate the JS bundle of an AMD modular project.

It's ideal for applications that builds bundles on the fly using Node.js.

Usage

npm install builder-amd

var fs = require( "js" );
var amdBuilder = require( "builder-amd" );

var files = {
  "main.js": fs.readFileSync( "./main.js" ),
  "foo.js": fs.readFileSync( "./foo.js" ),
  "bar.js": fs.readFileSync( "./foo.js" )
  ...
}

amdBuilder( files, {
  include: "main"
}, function( error, builtJs ) {
  ...
});

API

  • amdBuilder( files, requirejsConfig, callback )

files Object containing (path, data) key-value pairs, e.g.:

{
   <path-of-file-1>: <data-of-file-1>,
   <path-of-file-2>: <data-of-file-2>,
   ...
}

requirejsConfig Object require.js build configuration.

callback Function called with three arguments: null or an Error object, a String with the built css content, an Object with the cloned built files structure.

Test

npm test

License

MIT © Rafael Xavier de Souza

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free