Skip to content

Commit

Permalink
Add scale option
Browse files Browse the repository at this point in the history
Fixes #137.
  • Loading branch information
kevva committed Nov 3, 2014
1 parent c62b3f2 commit 1061719
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ var options = subarg(process.argv.slice(2), {
'version'
],
default: {
delay: 0
delay: 0,
scale: 1
},
alias: {
v: 'verbose',
Expand Down Expand Up @@ -63,6 +64,7 @@ function showHelp() {
--cookie <cookie> Browser cookie, can be set multiple times
--username <username> Username for HTTP auth
--password <password> Password for HTTP auth
--scale <number> Scale webpage
<url> can also be a local file path.
Expand Down
11 changes: 11 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ Username for HTTP auth.

Password for HTTP auth.

##### `--scale <number>`

Scale webpage `n` of times.


## Config file

Expand Down Expand Up @@ -259,6 +263,13 @@ Type: `string`

Password for authenticating with HTTP auth.

##### scale

Type: `Number`
Default: `1`

Scale webpage `n` times.


### pageres.src(url, sizes, options)

Expand Down
17 changes: 17 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,23 @@ test('auth using username and password', function (t) {
});
});

test('scale webpage using the `scale` option', function (t) {
t.plan(3);

var pageres = new Pageres({scale: 2, crop: true})
.src('yeoman.io', ['120x120']);

pageres.run(function (err, streams) {
t.assert(!err, err);

streams[0].pipe(concat(function (data) {
var size = imageSize(data);
t.assert(size.width === 240);
t.assert(size.height === 240);
}));
});
});

function cookieTest (port, input, t) {
t.plan(6);
var server = new Server(port);
Expand Down

0 comments on commit 1061719

Please sign in to comment.