d3smush
A simple Python module to facilitate easy smushing of D3 components.
Installing
d3smush requires Node and NPM, so make sure you have installed those first. It also requires Uglify-JS so make sure you install it using npm -g install uglify-js
.
If you use Pip, use pip install d3smush
to install d3smush. Otherwise, download the latest release and run as a standalone Python script with python d3smush.py <optional_output_file>
.
Usage
d3smush <optional_output_file>
d3smush gathers the required packages from the dependencies
section of package.json
. It then analyzes dependencies from the central NPM registry to determine dependency order. Finally, it creates a minified JS file using this file order.
If you have not initialized a package.json
file, run npm init
in order to do so and add the dependencies
there. An optional output parameter may be passed as shown above to change the save location. The default is ./d3.min.js
.
In the spirit of D3 4.0, d3smush intentionally does not have an Install All Packages feature.