Book Image

PhantomJS Cookbook

By : Rob Friesel
Book Image

PhantomJS Cookbook

By: Rob Friesel

Overview of this book

Table of Contents (15 chapters)
PhantomJS Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Executing a YSlow performance analysis with a custom ruleset


In this recipe, we will create a custom-defined ruleset for YSlow and execute a performance analysis with it.

Getting ready

To run this recipe, we will need a target URL.

We will use the PhantomJS port of the YSlow library to execute the performance analysis on our target web page. However, as we are creating a custom ruleset, we must build the library from source. To obtain the YSlow library source code, we change directories into the sample code repository and initialize the submodule as shown in the following command:

git submodule init && git submodule update

Tip

Alternatively, we can click the download link on the project's GitHub page https://github.com/marcelduran/yslow.

If we download the .zip from the GitHub project page, we may need to rename the folder from yslow-master to yslow before we move it into the lib directory.

We will need a custom ruleset for the YSlow library. An example of such a custom ruleset is included...