PSI

If you are into web development at one point or the other you would have used Google's pagespeed insights to improve the performance of your site.

Now it's even easier to get those insights on your CLI with psi thanks to the Addy Osmani for such a wonderful module.

Formal defination of the module:

PageSpeed Insights With Reporting

Run mobile and desktop performance tests for your deployed site using Google PageSpeed Insights with tidy reporting for your build process. A sample Gulpfile demonstrating use is also available.

Uses gpagespeed and the reporter in grunt-pagespeed.

Install it -> $ npm install psi

Example usage:

P.S: Registering for an API key from the Google Developer Console is recommended.

In code:

1
2
3
4
5
6
7
8
9
10
var psi = require('psi');

psi({
  // key: '...', optional
  url: 'http://nmotw.in',
  paths: '',           // optional
  locale: 'en_US',     // optional
  strategy: 'mobile',  // optional
  threshold: 80        // optional
});

On CLI:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$ psi http://nmotw.in --strategy desktop
Running Pagespeed Insights
Pagespeed Insights: Processing results

----------------------------------------------------------------

URL:      http://nmotw.in/
Strategy: desktop
Score:    90

----------------------------------------------------------------

Number Resources                                 | 16
Number Hosts                                     | 7
Total Request Bytes                              | 1538
Number Static Resources                          | 8
Html Response Bytes                              | 7019
Css Response Bytes                               | 17484
Image Response Bytes                             | 384
Javascript Response Bytes                        | 228348
Other Response Bytes                             | 221982
Number Js Resources                              | 5
Number Css Resources                             | 3

----------------------------------------------------------------

Avoid Landing Page Redirects                     | 0
Enable Gzip Compression                          | 0
Leverage Browser Caching                         | 1.5
Main Resource Server Response Time               | 0
Minify Css                                       | 0
Minify HTML                                      | 0
Minify Java Script                               | 0.16
Minimize Render Blocking Resources               | 8
Optimize Images                                  | 0
Prioritize Visible Content                       | 0

----------------------------------------------------------------

If you have bunch of sites to analyse you could something like:

1
cat links | xargs -L1 psi > analysis.report

GIF FTW!

psi

Suggest a module

Comments