Giter Site home page Giter Site logo

grunt-yslow's Introduction

grunt-yslow

Grunt task for testing page performance using PhantomJS, a headless WebKit browser.

Getting Started

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 grunt.js gruntfile:

grunt.loadNpmTasks('grunt-yslow');

Also make sure that phantomjs is in the $PATH. You can add ./node_modules/grunt-yslow/node_modules/grunt-lib-phantomjs/node_modules/phantomjs or do a $ npm install --global phantomjs


##Config All config must be specified in your Gruntfile.js under the task name yslow.

###Options

  • 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] (http://yslow.org/ruleset-matrix/) (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: 180,
      speed: 1000,
      score: 80,
      requests: 15
    }
  },
  pages: {
    files: [
      {
        src: 'http://andyshora.com'
      },
      {
        src: 'http://www.google.co.uk',
        thresholds: {
          weight: 100
        }
      }
    ]
  }
}

grunt-yslow's People

Contributors

andyshora avatar nickgoward avatar attiks avatar cactusa avatar cnorthwood avatar chuckcarpenter avatar jamsyoung avatar ronaldtreur avatar

Watchers

James Cloos avatar

Forkers

eslagter itv cactusa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.