Created
September 29, 2018 03:39
-
-
Save jaxbot/18cf78ba9f2249249118836a3256812f to your computer and use it in GitHub Desktop.
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
const puppeteer = require('puppeteer'); | |
var sizes = [ | |
{ | |
name: "1080p", | |
width: 1920, | |
height: 1080, | |
isMobile: false | |
}, | |
{ | |
name: "iPhone X", | |
width: 375, | |
height: 812, | |
isMobile: true | |
}, | |
]; | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
await page.goto('https://jaxbot.me/'); | |
for (var i = 0; i < sizes.length; i++) { | |
let size = sizes[i]; | |
await page.setViewport(size); | |
await page.screenshot({path: 'example' + size.name + '.png'}); | |
} | |
await browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment