Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use puppeteer to automatically generate code screenshots for social media #23

Open
prtksxna opened this issue Aug 21, 2018 · 0 comments

Comments

@prtksxna
Copy link
Member

npm install puppeteer --save
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('http://localhost:4567/blog/two-negatives-must-make-a-positive.html');
  const code = await page.$('code');
  await code.screenshot({path: 'code.png'});
  await browser.close();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant