Skip to content

Commit

Permalink
Feature/common use cases (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanMaRuiz authored Apr 6, 2020
1 parent 1561b67 commit 129568b
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,34 @@ $ psi --help
$ psi https://addyosmani.com --strategy=mobile
```

## Common Use cases

## Getting PSI into your build process
<details>
<summary>Getting PSI into your build process.</summary><br>

A sample [Gulp](https://github.com/addyosmani/psi-gulp-sample) project using PSI is available.

If you use Grunt, [`grunt-pagespeed`](https://github.com/jrcryer/grunt-pagespeed) is a task by James Cryer that uses PSI under the hood.

For testing local projects, we recommend using [`psi-ngrok`](https://github.com/denar90/psi-ngrok) or [`ngrok`](http://www.jamescryer.com/2014/06/12/grunt-pagespeed-and-ngrok-locally-testing/).
</details>

<details>
<summary>Getting filmstrips</summary>

**Filmstrips** are returned by the v5 API as data uri's but the psi tool does not expose them on the cli. If you want to get **filmstrips** (or any audit details) you can require `psi` and get them from the `audits` object:

```javascript
const psi = require('psi');

(async () => {
// Get the PageSpeed Insights report
const {data} = await psi('https://theverge.com');
console.log(data.lighthouseResult.audits['screenshot-thumbnails'].details.items);
})();
```

</details>

## License

Expand Down

0 comments on commit 129568b

Please sign in to comment.