Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Bundle

Bundle files into a single file using browserify.

Usage

var bundle = require( '@stdlib/tools/browserify/bundle' );

bundle( files, [dest,] clbk )

Bundle files into a single file using browserify.

var files = [
    '/foo/bar.js',
    '/beep/boop.js'
];

bundle( files, clbk );

function clbk( error, bundle ) {
    if ( error ) {
        throw error;
    }
    console.log( bundle.toString() );
}

To specify an output file path, provide a dest argument.

var files = [
    '/foo/bar.js',
    '/beep/boop.js'
];

bundle( files, './bundle.js', clbk );

function clbk( error ) {
    if ( error ) {
        throw error;
    }
}

Examples

var join = require( 'path' ).join;
var bundle = require( '@stdlib/tools/browserify/bundle' );

var fpath = join( __dirname, 'fixtures', 'index.js' );
var files = [ fpath ];

bundle( files, onBundle );

function onBundle( error, output ) {
    if ( error ) {
        throw error;
    }
    console.log( output.toString() );
}

CLI

Usage

Usage: browserify-bundle [options] file1 file2 ...

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Examples

$ browserify-bundle ./examples/fixtures/index.js