Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Node.js wrapper for phantomjs yslow.js (see:
JavaScript Shell
branch: master

Upping yslow version.

latest commit 2b438b9e85
Josh Mervine authored
Failed to load latest commit information.
lib Updating for better error handling.
scripts Upping yslow version.
test Updating for better error handling.
.gitignore updating .gitignore
.travis.yml Update .travis.yml
Makefile commiting total refactor with updated phapper
NOTES.mdown Update NOTES.mdown Update
package.json Upping yslow version.

YSlow.js on Node.js

Build Status   Dependancy Status   NPM Version  

YSlow.js on Node.js is a simple Node.js wrapper for programmatically running phantomjs yslow.js.



  1. PhantomJS in your PATH.
  2. Tested on the following node versions (via
    • 0.8
    • 0.10


$ npm install yslowjs

See Phapper if you're having issues with PhantomJS.

Additional Installation Notes

You can specify different versions of YSlow.js using npm config:

$ npm config set yslowjs_version

You will have to reinstall yslowjs if you change this option after initially installing it.

Windows? Click here!

Configuration Options

var yslow = new YSlow('',
    [ '--arg', 'value' ]);
    // Supported:
    //   info     specify the information to display/log (basic|grade|stats|comps|all) [all],
    //   ruleset  specify the YSlow performance ruleset to be used (ydefault|yslow1|yblog) [ydefault],
    //   beacon   specify an URL to log the results,
    //   ua       specify the user agent string sent to server when the page requests resources,
    //   viewport specify page viewport size WxY, where W = width and H = height [400x300],
    //   headers  specify custom request headers, e.g.: -ch '{\'Cookie\': \'foo=bar\'}',
    // WARNING: format is locked at json, so don't pass it!

Usage Examples


// file: async.js
var YSlow = require('lib/yslow');
var yslow = new YSlow('',
    [ '--info', 'basic' ]);
console.log('\nRunning (Async)....'); function (error, result) {
    if (error) {
    } else {
        console.log('=> overall:   ' + result.o);
        console.log('=> load time: ' +;


// file: sync.js
var YSlow = require('lib/yslow');
var yslow = new YSlow('',
    [ '--info', 'basic' ]);
console.log('\nRunning (Sync)....');
var results = yslow.runSync();
console.log('=> overall:   ' + results.o);
console.log('=> load time: ' +;

Using Custom yslow.js Download

var YSlow = require('lib/yslow');
YSlow.prototype.script = '/path/to/your/yslow.js';
// continue on
Something went wrong with that request. Please try again.