GithubHelp home page GithubHelp logo

pageres's Introduction

pageres

Coverage Status XO code style

Capture screenshots of websites in various resolutions. A good way to make sure your websites are responsive. It's speedy and generates 100 screenshots from 10 different websites in just over a minute. It can also be used to render SVG images.

See pageres-cli for the command-line tool.

Install

npm install pageres

Note to Linux users: If you get a "No usable sandbox!" error, you need to enable system sandboxing.

Usage

import Pageres from 'pageres';

await new Pageres({delay: 2})
	.source('https://github.com/sindresorhus/pageres', ['480x320', '1024x768'], {crop: true})
	.source('https://sindresorhus.com', ['1280x1024', '1920x1080'])
	.source('data:text/html,<h1>Awesome!</h1>', ['1024x768'])
	.destination('screenshots')
	.run();

console.log('Finished generating screenshots!');

API

Pageres(options?)

options

Type: object

delay

Type: number (Seconds)
Default: 0

Delay capturing the screenshot.

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

timeout

Type: number (Seconds)
Default: 60

Number of seconds after which the request is aborted.

crop

Type: boolean
Default: false

Crop to the set height.

css

Type: string

Apply custom CSS to the webpage. Specify some CSS or the path to a CSS file.

script

Type: string

Apply custom JavaScript to the webpage. Specify some JavaScript or the path to a file.

cookies

Type: Array<string | object>

A string with the same format as a browser cookie or an object.

Tip: Go to the website you want a cookie for and copy-paste it from DevTools.

filename

Type: string
Default: '<%= url %>-<%= size %><%= crop %>'

Define a customized filename using Lo-Dash templates.
For example: <%= date %> - <%= url %>-<%= size %><%= crop %>.

Available variables:

  • url: The URL in slugified form, eg. http://yeoman.io/blog/ becomes yeoman.io!blog
  • size: Specified size, eg. 1024x1000
  • width: Width of the specified size, eg. 1024
  • height: Height of the specified size, eg. 1000
  • crop: Outputs -cropped when the crop option is true
  • date: The current date (YYYY-MM-DD), eg. 2015-05-18
  • time: The current time (HH-mm-ss), eg. 21-15-11
incrementalName

Type: boolean
Default: false

When a file exists, append an incremental number.

selector

Type: string

Capture a specific DOM element matching a CSS selector.

hide

Type: string[]

Hide an array of DOM elements matching CSS selectors.

username

Type: string

Username for authenticating with HTTP auth.

password

Type: string

Password for authenticating with HTTP auth.

scale

Type: number
Default: 1

Scale webpage n times.

format

Type: string
Default: png
Values: 'png' | 'jpg'

Image format.

userAgent

Type: string

Custom user agent.

headers

Type: object

Custom HTTP request headers.

transparent

Type: boolean
Default: false

Set background color to transparent instead of white if no background is set.

darkMode

Type: boolean
Default: false

Emulate preference of dark color scheme.

launchOptions

Type: object
Default: {}

Options passed to puppeteer.launch().

beforeScreenshot

Type: Function

The specified function is called right before the screenshot is captured, as well as before any bounding rectangle is calculated as part of options.element. It receives the Puppeteer Page instance as the first argument and the browser instance as the second argument. This gives you a lot of power to do custom stuff. The function can be async.

Note: Make sure to not call page.close() or browser.close().

import Pageres from 'pageres';

await new Pageres({
	delay: 2,
	beforeScreenshot: async (page, browser) => {
		await checkSomething();
		await page.click('#activate-button');
		await page.waitForSelector('.finished');
	}
})
	.source('https://github.com/sindresorhus/pageres', ['480x320', '1024x768', 'iphone 5s'], {crop: true})
	.destination('screenshots')
	.run();

console.log('Finished generating screenshots!');

pageres.source(url, sizes, options?)

Add a page to screenshot.

url

Required
Type: string

URL or local path to the website you want to screenshot. You can also use a data URI.

sizes

Required
Type: string[]

Use a <width>x<height> notation or a keyword.

A keyword is a version of a device from this list.

You can also pass in the w3counter keyword to use the ten most popular resolutions from w3counter.

options

Type: object

Options set here will take precedence over the ones set in the constructor.

pageres.destination(directory)

Set the destination directory.

directory

Type: string

pageres.run()

Run pageres.

Returns Promise<Uint8Array[]>.

Task runners

Check out grunt-pageres if you're using Grunt.

For Gulp and Broccoli, just use the API directly. No need for a wrapper plugin.

Built with Pageres

  • Break Shot - Desktop app for capturing screenshots of responsive websites.

Related

pageres's People

Contributors

allensh12 avatar brudaswen avatar brutaldev avatar c0b41 avatar cluk3 avatar dwoodiwiss avatar fregante avatar ionicabizau avatar jeroenverfallie avatar jopemachine avatar kevva avatar leovr avatar matz3 avatar maxkueng avatar notwoods avatar ntwb avatar oskarkvamme avatar paazmaya avatar rauberdaniel avatar safarsaitam avatar samverschueren avatar satyarohith avatar scottweinstein avatar shannonrothe avatar shekhargulati avatar sindresorhus avatar skvggor avatar vasco-santos avatar victorferraz avatar wopian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pageres's Issues

npm warning

Not sure if this is significant, getting a warning when installing pageres:

npm WARN git config --get remote.origin.url returned wrong result (git://github.com/sindresorhus/pageres)

browser min-with @ 600 pixels

Hi,

it seems the browser is able to set the with to a minimum of 600 pixels.
So trying to check mobile views with a with of about 340 pixels is not possible. The screenshot itself is cropped to 340px but the content flows out of the screenshot.

regards
tornography

Not working in my case

pageres todomvc.com yeoman.io 1366x768 1600x900

events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn EACCES
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)

SyntaxError: Parse error

Tested this on an angularjs app and getting reference errors ReferenceError: Can't find variable: angular. The app is fine in Chrome/Firefox/IE... any ideas?

Error: ✗ PhantomJS exited with return value 127

|system||system| tylers-mbp in ~/Downloads/pageres-master 2
○ → pageres adzoomer.com --sizes 1366x768, --file fkkf.png

/usr/local/lib/node_modules/pageres/node_modules/webshot/node_modules/tmp/lib/tmp.js:266
throw err;
^
Error: ✗ PhantomJS exited with return value 127
at /usr/local/lib/node_modules/pageres/cli.js:72:9
at callback (/usr/local/lib/node_modules/pageres/node_modules/each-async/each-async.js:54:12)
at failed (/usr/local/lib/node_modules/pageres/node_modules/each-async/each-async.js:23:7)
at callback (/usr/local/lib/node_modules/pageres/node_modules/each-async/each-async.js:54:12)
at failed (/usr/local/lib/node_modules/pageres/node_modules/each-async/each-async.js:23:7)
at ChildProcess. (/usr/local/lib/node_modules/pageres/node_modules/webshot/lib/webshot.js:201:9)
at ChildProcess.EventEmitter.emit (events.js:91:17)
at Process._handle.onexit (child_process.js:674:10)

Unhandled 'error' event

Hello,

I've tried to run the example and get this:

screen shot 2014-02-09 at 5 19 11 pm

System:

  • OS X: 10.9.1
  • Node.js: v0.10.25
  • NPM: 1.3.24

Strange Error on 1 URL?

I have been able to use with every URL I have tried except this 1 url will not work, it always gives this error....

codedevelopr.com

I run with pageres codedevelopr.com --sizes 1600x900

Error: ←[31mΓ£ù PhantomJS exited with return value 1←[39m at C:\Users\jason\AppData\Roaming\npm\node_modules\pageres\cli.js:72:9 at callback (C:\Users\jason\AppData\Roaming\npm\node_modules\pageres\node_modules\each-async\each-async.js:54:12) at failed (C:\Users\jason\AppData\Roaming\npm\node_modules\pageres\node_modules\each-async\each-async.js:23:7) at callback (C:\Users\jason\AppData\Roaming\npm\node_modules\pageres\node_modules\each-async\each-async.js:54:12) at failed (C:\Users\jason\AppData\Roaming\npm\node_modules\pageres\node_modules\each-async\each-async.js:23:7) at ChildProcess.<anonymous> (C:\Users\jason\AppData\Roaming\npm\node_modules\pageres\node_modules\webshot\lib\webshot.js:201:9) at ChildProcess.EventEmitter.emit (events.js:99:17) at Process._handle.onexit (child_process.js:678:10)

Update README.md to specify screenshot location

The README.md file should specify where screenshots will be saved by default.

This file should also make mention of whether the location of these screenshots can be changed in the command-line.

Doesn't detect "localhost:8080" as URL

I tried:

  • pageres localhost:8080 320x480 1200x3889
  • pageres http://localhost:8080 320x480 1200x3889

But both times I got a "Specify at least one url" message.

Error: spawn EMFILE

|system||system| tylers-mbp in ~/Downloads/pageres-master
○ → pageres adzoomer.com --file screenshot-output.png

/usr/local/lib/node_modules/pageres/node_modules/webshot/node_modules/tmp/lib/tmp.js:266
throw err;
^
Error: spawn EMFILE
at errnoException (child_process.js:838:11)
at ChildProcess.spawn (child_process.js:790:11)
at Object.exports.spawn (child_process.js:614:9)
at spawnPhantom (/usr/local/lib/node_modules/pageres/node_modules/webshot/lib/webshot.js:162:34)
at module.exports.spawn (/usr/local/lib/node_modules/pageres/node_modules/webshot/lib/webshot.js:84:7)
at module.exports (/usr/local/lib/node_modules/pageres/node_modules/webshot/lib/webshot.js:96:9)
at Object.fs.exists as oncomplete

Add renderDelay option

webshot do support renderDelay - Number of milliseconds to wait after a page loads before taking the screenshot. (default 0) in their options.

I found this option very useful when handling chart/animation website like http://www.highcharts.com/demo/line-basic

How about adding this feature into pageres? It would be super helpful.

Thanks :)

Tests

Need to write a good amount of tests. Boring... Just need to settle on the API first.

PR welcome (hah right). I will be forever thankful and let you ride my unicorn.

Inconsistant output between reality and screenshot

When testing out pageres, I used a localhost example and the results were not identical between what a browser renders at a mobile compatible screen size and what pageres offered as a screenshot.

In the example attached, the left represents Google Chrome emulation for an iPhone. The image on the right is the output from pageres. These block elements, which are set to 50% wide, float left, did not keep their constraints.

screen shot 2014-02-18 at 2 04 09 pm

[Feature] Option to capture exact size

Currently there are no way to create screenshots with fixed height, without modifying index.js

Where "pageres todomvc.com 1024x768" does not produce 1024x768 image, I need to modifying index.js to do so.

        shotSize: {
            width: 'window',
            height: 'window'
        }

Adding a parameter to modify this behavior would be nice. e.g.
pageres -x todomvc.com 1024x768

Pass cookie through programmatic API

Right now you can't screenshot a site behind a login wall. If we could only pass a cookie through to the underlying PhantomJS instance, we'd be able to take screenshots as a given user.

where is the image saved?

I would assume the following:

  1. Desktop
  2. Downloads
  3. home folder
  4. PWD

I didn't find the screenshots in any of the above, also tried to spotlighting new '.pngs' with the url as part of the title and still came up with nothing

Error when trying to take screenshots from urls in a text file

I get an error when taking screenshots from a text file.
My text file is called urls.txt which has urls like below:
http://www.yahoo.com
http://www.microsoft.com
http://www.google.com

On hitting - pageres 768x1024 < urls.txt command, it takes a screenshot of only the last URL in the file i.e. http://www.google.com but throws an error(shown below) for all the urls above it.
TypeError: 'undefined' is not an object < evaluating 'options.windowSize.width' >

pageres works fine if I mention urls directly in the command but when it comes from a text file, it just throws an error. I need to take screenshots of hundreds of urls so text file is the only option for me.
Any idea how can I fix this issue?

Cannot install cli from npm

eddie # npm install --global pageres
eddie # cat npm-debug.log
info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'install', '--global', 'pageres' ]
info using [email protected]
info using [email protected]
verbose config file /root/.npmrc
verbose config file /usr/etc/npmrc
verbose config file /usr/share/npm/npmrc
silly exec /usr/bin/node "/usr/share/npm/bin/npm-get-uid-gid.js" "nobody" 1005
silly spawning [ '/usr/bin/node',
silly spawning [ '/usr/share/npm/bin/npm-get-uid-gid.js', 'nobody', 1005 ],
silly spawning null ]
silly output from getuid/gid {"uid":65534,"gid":1005}
silly output from getuid/gid
verbose cache add [ 'pageres', null ]
silly cache add: name, spec, args [ undefined, 'pageres', [ 'pageres', null ] ]
verbose parsed url { pathname: 'pageres', path: 'pageres', href: 'pageres' }
verbose addNamed [ 'pageres', '' ]
verbose addNamed [ null, '' ]
silly name, range, hasData [ 'pageres', '', false ]
verbose raw, before any munging pageres
verbose url resolving [ 'https://registry.npmjs.org/', './pageres' ]
verbose url resolved https://registry.npmjs.org/pageres
http GET https://registry.npmjs.org/pageres
ERR! Error: failed to fetch from registry: pageres
ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
ERR! at Request. (/usr/lib/nodejs/request/main.js:212:58)
ERR! at Request.emit (events.js:88:20)
ERR! at ClientRequest. (/usr/lib/nodejs/request/main.js:412:12)
ERR! at ClientRequest.emit (events.js:67:17)
ERR! at HTTPParser.onIncoming (http.js:1261:11)
ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
ERR! You may report this log at:
ERR! http://bugs.debian.org/npm
ERR! or use
ERR! reportbug --attach /home/eddie/npm-debug.log npm
ERR!
ERR! System Linux 3.2.0-38-generic
ERR! command "node" "/usr/bin/npm" "install" "--global" "pageres"
ERR! cwd /home/eddie
ERR! node -v v0.6.12
ERR! npm -v 1.1.4
ERR! message failed to fetch from registry: pageres
verbose exit [ 1, true ]

Password protection

Password protected development enviroments at a webserver are not acesssible. Generation of screenshots fail. No possibility to make the login.

Not working on Windows

Since this is on the NodeJS platform it should probably work on WIndows aswell. I might be missing something, but it didn't do the trick for me. Works fine on Ubuntu though

Unhandled "error" event

Hi there,

I've always the same error when I tried to use pageres in terminal (Max OS Maverick) :

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn EACCES
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

Don't understand why...

Change Filename

Is it possible to define a custom filename (or even better add the current date/timestamp using a flag)?

E.g. I'd like to make a screenshot of a website every day with a timestamp added to see how it changes over time.

Windows Support??

Just tried to install it using my git bash on a Win7 machine and got this:

image

Are there any constraints regarding the PhantomJS version?? I currently have 1.6.1.

Unused `.jshintrc`

npm test only runs Mocha test, but not JSHint. It shouldn't be a problem, but there is .jshintrc, so JSHint should be ran?

Add option to specify whether the URLs are lower cased or not

Currently all URLs to which one calls pageres on are lower cased and NOT all HTTP servers consider URLs case insensitive.

Example if you run:

pageres "http://ANSWERS.oreilly.com/topic/108-hOw-to-perMit-case-insensItive-urls-with-aPaChE/ " 1366x768

on the server's access log you'll actually see that the request is made to the lowercase URL: http://answers.oreilly.com/topic/108-how-to-permit-case-insensitive-urls-with-apache/

IPADDRESS - - [21/Mar/2014:12:00:14 +0xxx] "GET /topic/108-how-to-permit-case-insensitive-urls-with-apache/ HTTP/1.1" 404 797 "-" "Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.7 Safari/534.34"

Which depending on whether the server handles URLs case insensitively might work or not.

That is, when you make the request to an URL with uppercase characters in it, you'll get the same result or NOT as when you make it to the URL with lowercase characters.

Windows issue, PhatomJS error

When I run pageres todomvc.com --sizes 1366x768 and I am getting the following error:

"C:\inetpub\npm\node.exe" "C:\inetpub\npm\node_modules\phantomjs
bin\phantomjs" C:\inetpub\npm\node_modules\pageres\node_modules\webshot\lib/webshot.phantom.js http:
//todomvc.com todomvc.com-1366x768.png false "{"windowSize":{"width":"1366","height":"768"
},"shotSize":{"width":"window","height":"all"},"shotOffset":{"left":0,"right":0,"to
p":0,"bottom":0},"script":"function () {}","streamType":"png","siteType":"url"}"

C:\inetpub\npm\node_modules\pageres\cli.js:72
throw new Error(chalk.red('Ô£ù ' + err.message));
^
Error: ←[31mÔ£ù PhantomJS exited with return value 255←[39m
at C:\inetpub\npm\node_modules\pageres\cli.js:72:9
at callback (C:\inetpub\npm\node_modules\pageres\node_modules\each-async\each-async.js:54:12)
at C:\inetpub\npm\node_modules\pageres\node_modules\each-async\each-async.js:23:7
at callback (C:\inetpub\npm\node_modules\pageres\node_modules\each-async\each-async.js:54:12)
at C:\inetpub\npm\node_modules\pageres\node_modules\each-async\each-async.js:23:7
at ChildProcess. (C:\inetpub\npm\node_modules\pageres\node_modules\webshot\lib\websho
t.js:201:9)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:789:12)

I am running command as administrator so there shouldn't be any issues there and phatomJS is installed.

Windows 7, 64bit, node version: v0.10.25

Any ideas?

Thanks

Error: ✗ PhantomJS exited with return value 2

This is great project. I used this on my mac. Result is fantastic. But on raspberry pi, I met a problem.

I use raspberry pi for private server. You know pi has arm cpu. So I compiled nodejs(v0.10.25) on pi. And installed pageres using npm with global option. Then, error below was came.

/usr/local/lib/node_modules/pageres/cli.js:54
            throw new Error(chalk.red('✗ ' + err.message));
                  ^
Error: ✗ PhantomJS exited with return value 2
    at /usr/local/lib/node_modules/pageres/cli.js:54:10
    at callback (/usr/local/lib/node_modules/pageres/node_modules/each-async/each-async.js:54:12)
    at /usr/local/lib/node_modules/pageres/node_modules/each-async/each-async.js:23:7
    at callback (/usr/local/lib/node_modules/pageres/node_modules/each-async/each-async.js:54:12)
    at /usr/local/lib/node_modules/pageres/node_modules/each-async/each-async.js:23:7
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/pageres/node_modules/webshot/lib/webshot.js:201:9)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at Process.ChildProcess._handle.onexit (child_process.js:797:12)

CLI issue/question

Hi, how is it supposed to work?

In terminal I run

  1. sudo npm install pageres
  2. pageres -h -> working fine
  3. pageres todomvc.com yeoman.io --sizes 1366x768,1600x900 raises error
events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn EACCES
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

Thanks.

Empty Files Created

I'm using pageres on Windows 8.1 (x64) and it works for non-local pages.

However, if I use a localhost (or 127.0.0.1) URL (eg http://127.0.0.1:3333), the success message is presented, but the file is empty. Any ideas?

Output directory

Can you add an option for the output directory to be set in the CLI ?

Error on Windows using Git Bash

I just tried to installed it on windows using npm install pageres --global and it installs fine, but when i run pageres i get command not found.

Do you guys have any idea why ?

Then I tried running

 node /path/to/nodejs/node_modules/pageres/cli.js todomvc.com yeoman.io 1366x768 1600x900

and got the following error message:

child_process.js:923
  var r = this._handle.spawn(options);
                       ^
TypeError: Bad argument
    at ChildProcess.spawn (child_process.js:923:24)
    at Object.exports.spawn (child_process.js:723:9)
    at spawnPhantom (E:\libexec\nodejs\node_modules\pageres\node_modules\webshot\lib\webshot.js:162:34)
    at spawn (E:\libexec\nodejs\node_modules\pageres\node_modules\webshot\lib\webshot.js:84:7)
    at E:\libexec\nodejs\node_modules\pageres\node_modules\webshot\lib\webshot.js:96:9
    at Object.cb [as oncomplete] (fs.js:168:19)

unable to install

npm doesn't seem to want to install pageres:

dlg@erebus:/tmp$ sudo npm install --global pageres
npm http GET http://registry.npmjs.org/pageres
npm http 304 http://registry.npmjs.org/pageres

npm ERR! Error: No compatible version found: pageres
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR!     at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR!     at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR!     at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR!     at /usr/share/npm/lib/cache.js:408:5
npm ERR!     at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR!     at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /tmp/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.2.0-39-generic-pae
npm ERR! command "node" "/usr/bin/npm" "install" "--global" "pageres"
npm ERR! cwd /tmp
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: pageres
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /tmp/npm-debug.log
npm not ok
dlg@erebus:/tmp$ lsb_release -ac
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.4 LTS
Release:        12.04
Codename:       precise
dlg@erebus:/tmp$ npm --version
1.1.4
dlg@erebus:/tmp$

Support UTF8?

It seems currently not support UTF8. Any plan for this feature?

url is toLowerCase()'d

Any url given to pageres is lowercased.

I think we all agree case shouldn't matter to many webservers - but once in a while it does, in which case pageres fails to take snapshops of the correct url.

Is there some justification for lower-casing, or can we change this?

Specify user agent or device

I'm not sure what would be the best approach. I think that it would be interesting being able to define the user agent or the device (user agent + screen size). Some ideas:

  1. Pass as an option the user agent to be used in the webshot. For example:
pageres google.com --sizes 320x480 --useragent="Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.20 (KHTML, like Gecko) Mobile/7B298g"
  1. Pass as an option the device or devices. In this case, we should have a list of devices and their screen sizes and user agents:
pageres google.com --device iphone4s

I guess that it wasn't the idea for this module, but a lot of web sites shows a different layout depending on the user agent: desktop and mobile mainly.

I made the modifications to set the User Agent, but maybe it would be better to set the device or be able to do both. Feedback?

Error when running example command

rocktop:screendoor-v2 adamb$ pageres todomvc.com yeoman.io --sizes 1366x768,1600x900

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn EACCES
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)
rocktop:screendoor-v2 adamb$ 

Error - can't open $PATH/pageres/converter.js

Got the following error when trying to run against localhost (server is up and running in that port)

jjperezaguinaga.com git:(features/stylrs-integration) ✗ pageres http://localhost:8000 1280x800

/opt/boxen/nodenv/versions/v0.10.21/lib/node_modules/pageres/cli.js:47
                throw err;
                      ^
Can't open '/opt/boxen/nodenv/versions/v0.10.21/lib/node_modules/pageres/converter.js'

Version is 0.2.3. Tried forwarding domain through etc/hosts/ without success. I'll keep you updated.

Throws error, even with example call

$ pageres todomvc.com yeoman.io --sizes 1366x768,1600x900

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn EACCES
    at errnoException (child_process.js:988:11)
    at Process.ChildProcess._handle.onexit (child_process.js:779:34)

PhantomJS exists with return value 1 when using filesystem files (not urls)

This is what happens:

$ pageres 1200x600 index.html

/usr/local/share/npm/lib/node_modules/pageres/cli.js:54
            throw new Error(chalk.red('✗ ' + err.message));
                  ^
Error: ✗ PhantomJS exited with return value 1
    at /usr/local/share/npm/lib/node_modules/pageres/cli.js:54:10
    at callback (/usr/local/share/npm/lib/node_modules/pageres/node_modules/each-async/each-async.js:54:12)
    at /usr/local/share/npm/lib/node_modules/pageres/node_modules/each-async/each-async.js:23:7
    at callback (/usr/local/share/npm/lib/node_modules/pageres/node_modules/each-async/each-async.js:54:12)
    at /usr/local/share/npm/lib/node_modules/pageres/node_modules/each-async/each-async.js:23:7
    at ChildProcess.<anonymous> (/usr/local/share/npm/lib/node_modules/pageres/node_modules/webshot/lib/webshot.js:201:9)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at Process.ChildProcess._handle.onexit (child_process.js:797:12)

Not sure what about this. Just not the best first-run experience. Hopefully it's easy to fix.

I am using PhantomJS-1.9.7 which otherwise works fine.

Error: spawn EACCES

Running the example command …

❯ pageres todomvc.com yeoman.io 1366x768 1600x900

Gives this error:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn EACCES
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

And …

❯ sudo !!

… gives the following warning:

You are not allowed to run this app with root permissions.
If running without sudo doesn't work, you can either fix your permission problems or change where npm stores global packages by putting ~/npm/bin in your PATH and running:
npm config set prefix ~/npm

… in which I did the latter part, i.e. adding ~/npm/bin in my $home (had to create the directory) and include it in my $PATH.

Still the same error. Any clues?


Versions of binaries

node 0.10.24
npm 1.3.21
pageres 0.2.3
phantomjs 1.9.7 (The one that came as a dependency when installing pageres)

OS

Mac OS X 10.9.1

Fonts not rendering

Hello,
Wonderful work and thanks a lot for sharing . The only problem I noticed is that when you try to capture a website that is using icons like Font-awesome, the icons don't render!

I am using Mac OS 10.9.1

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.