Grunt task for testing page performance using PhantomJS, a headless WebKit browser.
Install this grunt plugin next to your project's [grunt.js gruntfile] with:
npm install grunt-yslow --save-dev
Then add this line to your project's
All config must be specified in your Gruntfile.js under the task name yslow.
- thresholds (object) - An object specifying the global thresholds to test against. These can be overridden by higher specificity against inside the files section below.
- weight (number) - The maximum page weight allowed (kb).
- speed (number) - The maximum load time of the page allowed (ms).
- score (number) - The minimum YSlow performance score (out of 100) required.
- requests - The maximum number of requests the page is allowed to send on load.
- yslowOptions (object) - An object specifying any additional parameters for Yslow to use when running the test. This can be overridden below, like thresholds.
- userAgent (string) - The User-Agent to present to the server
- cdns (array of strings) - A list of additional hostnames for Yslow to accept as a Content Delivery Network
- viewport (string) - the size of the viewport in the form WxH, where W is the width and H is the height
- headers (object) - an object where keys are the header names and values are the values of additional headers to add to the request
- files (object) - An array of objects, specifying a seperate page to test. Generally this is wrapped inside a named sub-task, such as the 'pages' task in the example below.
- src (string) - The absolute url to test.
- thresholds (object) - Any overrides to the global thresholds for this page.
- yslowOptions (object) - Any overrides to the global Yslow Options for this page.
Example Grunt Task
yslow:options:thresholds:weight: 180speed: 1000score: 80requests: 15pages:files:src: ''src: ''thresholds:weight: 100