Building DataTables

DataTables is essentially one large Javascript file, but its source is split into manageable individual files that are combined to create the main library file. This is DataTables build process and if you'd like to modify DataTables from source you'll need to go through this process.

Environment and software

The DataTables build process is supported on Mac and Linux platforms - Windows builds are possible but currently only with a Unix shell such as Cygwin. The following software is required to be able to build DataTables:

Obtaining the source

The DataTables source is available on GitHub which means obtaining the code is as simple as:

git clone https://github.com/DataTables/DataTablesSrc.git

Paths

Before building the software, ensure that the paths to Closure Compiler and JSHint are correct for your computer - the paths are defined at the top of build/include.sh.

Building

To build the code cd DataTablesSrc/build and run:

./make.sh build [debug]

The debug part is optional (which is why it is shown in square brackets). When debug is enabled the minification process using Closure compiler is skipped resulting in faster build times, but no minified file is produced, meaning it is only useful for debugging.

The build process will look something like:

  DataTables build (1.10.10) - branch: master 

  Deploying to build repo 
    Pulling latest changes for build repo from origin 
  JS 
    JSHint passed 
    JS compressing jquery.dataTables.js 
      File size: 81733 
    JS compressing dataTables.bootstrap.js 
      File size: 2334 
    JS compressing dataTables.foundation.js 
      File size: 1907 
    JS compressing dataTables.jqueryui.js 
      File size: 2647 
  CSS 
    CSS compressing dataTables.bootstrap.css 
      File size: 4247 
    CSS compressing dataTables.foundation.css 
      File size: 2608 
    CSS compressing dataTables.jqueryui.css 
      File size: 14097 
    CSS compressing jquery.dataTables.css 
      File size: 13615 
  Images 
  Examples 
    Updating package descriptors 

  Done 

Output

The output files (Javascript, CSS, images and examples) are placed into the built/DataTables directory where the examples can immediately be run from a localhost.

Extensions

DataTables extensions also go through the same build process using this script, although in this case:

./make.sh extension {name} [debug]

where, again debug is optional and in this case {name} is the name of the extension. The script will automatically clone the extension from the DataTables repositories and then built it and its examples.

Output

The built extensions are placed into built/DataTables/extensions where the examples can immediately be run from a localhost.

Valid extensions

The following extension names are valid values for the {name} parameter (please note that capitalisation is important):

  • AutoFill
  • Buttons
  • ColReorder
  • FixedColumns
  • FixedHeader
  • KeyTable
  • Plugins
  • Responsive
  • RowReorder
  • Scroller
  • Select