Optimizing WebViewer assets

When loading WebViewer on an HTML page a number of JavaScript, CSS and other files need to be downloaded. If files are concatenated together and minified where appropriate then this can reduce the number of HTTP requests and bandwidth needed to download all of the WebViewer assets.

We've provided a gulpfile that can optionally be run to optimize this process.

  1. Download node.js and install it.
  2. Find gulpfile.js in the WebViewer download package, open the command line in this folder and run npm install
  3. Install gulp globally by running npm install -g gulp
  4. Run the command gulp. After this has completed there will be a lib/html5-min folder.
  5. Add the option html5Path: "html5-min/ReaderControl.html" and html5MobilePath: "html5-min/MobileReaderControl.html" to your WebViewer options.
If you make customizations to files like ReaderControl.js then you'll have to rerun the gulp command after each time you make changes.