Skip to content

Commit

Permalink
improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 31, 2014
1 parent 53bb8f3 commit 88a7840
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function showHelp() {
console.log(multiline.stripIndent(function () {/*
Get screenshots of websites in different resolutions.
Specify urls and screen resolutions as arguments. Order doesn't matter.
Specify urls and screen resolutions as arguments. Order doesn't matter. Group arguments with [ ]
Screenshots are saved in the current directory.
Usage
Expand Down
70 changes: 50 additions & 20 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ It's speedy and generates 100 screenshots from 10 different websites in just ove
![](screenshot-output.png)


## CLI app

### Install
## Install

```sh
$ npm install --global pageres
Expand All @@ -24,51 +22,83 @@ $ npm install --global pageres
*PhantomJS, which is used for generating the screenshots, is installed automagically, but in some [rare cases](https:/Obvious/phantomjs/issues/102) it might fail to and you'll get an `Error: spawn EACCES` error. [Download](http://phantomjs.org/download.html) PhantomJS manually and reinstall pageres if that happens.*


### Usage
## Usage

```sh
```
$ pageres --help
Get screenshots of websites in different resolutions.

Specify urls and screen resolutions as arguments. Order doesn't matter.
Specify urls and screen resolutions as arguments. Order doesn't matter. Group arguments with [ ]
Screenshots are saved in the current directory.
Usage
pageres <url> <resolution> [<resolution> <url> ...]
pagesres [<url> <resolution>] [<url> <resolution>]
pageres [<url> <resolution> ...] < <file>
cat <file> | pageres [<url> <resolution> ...]
pageres <url> <resolution>
pageres [ <url> <resolution> ] [ <url> <resolution> ]
pageres [ <url> <resolution> ... ] < <file>
cat <file> | pageres [ <url> <resolution> ... ]
Example
pageres todomvc.com yeoman.io 1366x768 1600x900
pageres [yeoman.io 1366x768 1600x900] [todomvc.com 1024x768 480x320]
pageres 1366x768 < urls.txt
pageres [ yeoman.io 1366x768 1600x900 ] [ todomvc.com 1024x768 480x320 ]
pageres --delay 3 1366x768 < urls.txt
cat screen-resolutions.txt | pageres todomvc.com yeoman.io
You can also pipe in a newline separated list of urls and screen resolutions which will get merged with the arguments.
If no screen resolutions are specified it will fall back to the ten most popular ones according to w3counter.
Options
-d, --delay <seconds> Delay capturing the screenshot
You can also pipe in a newline separated list of urls and screen resolutions which will get merged with the arguments. If no screen resolutions are specified it will fall back to the ten most popular ones according to w3counter.
```


## Programmatic API
## API

*The API is still in flux and might change between minor versions. Feedback welcome!*

### Install

```sh
$ npm install --save pageres
```

### Example
### Usage

```js
var eachAsync = require('each-async');
var pageres = require('pageres');

pageres({ url: 'yeoman.io', sizes: ['1366x768', '1600x900']}, null, function (err, streams) {
console.log('done');
var items = [{
url: 'yeoman.io',
sizes: ['480x320', '1024x768']
}, {
url: 'todomvc.com',
sizes: ['1280x1024', '1920x1080']
}];

pageres(items, { delay: 2 }, function (err, shots) {
eachAsync(shots, function (el, i, next) {
var stream = el.pipe(fs.createWriteStream(el.filename));
stream.on('finish', next);
stream.on('error', next);
}, function (err) {
if (err) {
throw err;
}

console.log('done');
});
});
```

### Options

#### delay

Type: `number`
Default: `0`

Delay capturing the screenshot.

Useful when the site does things after load that you want to capture.


## Google Analytics screen resolutions

Expand Down

0 comments on commit 88a7840

Please sign in to comment.