Installing JavaScript machinery

Note

This section is prepared for contributors to the Notebook source code. Users of the released Notebook do not need to install the JavaScript tools.

Building the Notebook from its GitHub source code requires some tools to create and minify JavaScript components and the CSS. These tools and the following steps are used when making a Notebook release.

  1. Install Node.js and npm.

    • Using the installers on Node.js website: Select a pre-built installer on the Node.js website. The installer will include Node.js and Node’s package manager, npm.

    • Using system’s package manager: Install Node.js and npm using the system’s package manager. For example, the command for Ubuntu or Debian is:

      sudo apt-get install nodejs-legacy npm
      
  2. Install the notebook:

    In the notebook repo, do a development install:

    pip install -e .
    
  3. Rebuild JavaScript and CSS

    There is a build step for the JavaScript and CSS in the notebook. You will need to run this command whenever there are changes to JavaScript or LESS sources:

    python setup.py js css
    

    This command will automatically fetch any missing dependencies (bower, less) and install them in a subdirectory.

Prototyping tip

When doing prototyping which needs quick iteration of the Notebook’s JavaScript, run npm run build:watch in the root of the repository. This will cause WebPack to monitor the files you edit and recompile them on the fly.