BundleNinja is a bundler for a tight subset of AMD/RequireJS with just 1kb (pre-gzip!) footprint. It's meant to be a replacement for r.js bundler and provide an absolutely minimal footprint in your final bundles. BN doesn't support many core features of RequireJS or AMD in general, so you must be really sure your application is using only a very strict subset of AMD (which I'll try to describle later below) and does not use any RequireJS plugins aside from
text - support for which is built in.
Packing code as strings adds a tiny overhead to the file size (extra backslashes), but the result is still smaller than anything you might get otherwise, even using almond.
Requires: node, coffeescript and uglify-js2
minify- boolean, if set to
truewill uglify the whole footprint after bundling is done (recommended).
bundle- array of directories within assets that should have all it's js and text files bundled recursively.
output- where the final bundled file should be saved.
main- the "main" module that should be initialized after the bundle is loaded.
texts- array of extensions that should be allowed to bundle as text modules with
text!prefix, perfect for mustache templates.
ignore- ignore list, by default it's good to ignore the
textplugin of RequireJS since BN will handle all
text!prefixes for you.
example.config.json or my boilerplate repo for a clear example.