Created
December 11, 2012 17:48
-
-
Save tizzo/4260589 to your computer and use it in GitHub Desktop.
Quick gist to demonstrate taking screenshots at different resolutions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log 'started' | |
options = | |
viewportSize: | |
width: 1900 | |
height: 1000 | |
snapshot = (width, height, path)-> | |
clip = | |
top: 0 | |
width: width | |
height: height | |
left: 0 | |
casper.viewport width, height | |
casper.then -> | |
casper.capture path, clip | |
console.log "snapped #{path}" | |
console.log 'options' | |
casper = require('casper').create options | |
url = casper.cli.args[0] | |
console.log 'required' | |
casper.start url, -> | |
console.log 'loaded' | |
snapshot 1900, 1000, 'screenshots/desktop.png' | |
@then -> | |
snapshot 320, 480, "screenshots/iphone.png" | |
@then -> | |
snapshot 820, 650, "screenshots/oddball.png" | |
@then -> | |
snapshot 768, 1024, "screenshots/ipad.png" | |
casper.run -> | |
@echo('done').exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment