block by joyrexus 7393907

Roll-your-own D3 bundle

Sample Makefile demonstrating how to roll-your-own D3 bundle that runs both in a browser and as a node module.

This is handy when you’re working on an app that only needs a slice of D3’s vast functionality. A minified D3 runs 144K, whereas a custom bundle of, say, D3’s array manipulation features is only 8K.

See the smash wiki for an overview of the process.

Our Makefile contains two build options (and their minified variants): one for building a standalone version of D3’s nest operator and one that pulls together all of D3’s array manipulation methods.

To build the first:

make d3-nest.js

To build the second:

make d3-array.js

Minified variants:

make d3-nest-min.js

make d3-array-min.js

Note: a pre-packaged nest and rollup operator with demo and docs is available here.

Makefile