Skip to content

Using the NodeJS Zazl Optimizer

Richard Backhouse edited this page Jul 21, 2013 · 9 revisions

Using the NodeJS Zazl Optimizer

If you have NodeJS installed (requires version >= 0.6) you can try the Node.js Zazl Optimizer.

It supports :

  1. Validation based caching.
  2. Gzipping of the response where applicable using Node.js zlib support
  3. The response can be javascript compressed by uglify-js
  4. Resources and Analysis data are cached for better response times (The first request on server start will be the slowest but from then on request will be substantially faster).

  • Install it via npm :

    npm install zazloptimizer

  • To try it out you can download the available examples, create an examples directory and unzip it into that.

  • To run via Connect run the following :

    node node_modules/.bin/zazlconnect examples

  • You can add node_modules/.bin to your PATH env to remove the need to prefix zazlconnect.

  • Note On windows you may have to bypass using the symlink and reference the js module directly. e.g

    node node_modules\zazloptimizer\jsbin\zazlconnect.js examples

  • To run on a different port :

    node node_modules/.bin/zazlconnect examples 9080

  • To turn off javascript compression (on by default, via uglify-js) :

    node node_modules/.bin/zazlconnect examples 9080 false

  • There are two samples available in the examples.zip that use direct injection for script loading.

    http://localhost:8080/inject_amdcalendar.html

    http://localhost:8080/inject_amddeclarative.html

Clone this wiki locally