How to use the puppeteer/DeviceDescriptors.map function in puppeteer

To help you get started, we’ve selected a few puppeteer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eugeniosegala / snap-this / utils / template.js View on Github external
const devices = require('puppeteer/DeviceDescriptors');
const { cleanNames } = require('./helpers');

const htmlElement = devices.map(device => {
  return `
      <div style="margin-bottom: 50px;" class="row">
        <div class="col-md-12">
          <h1 style="background-color: #1CACF4">
            Device: <span style="color: #fff">${device.name}</span>
            Resolution: <span style="color: #fff">${device.viewport.width} x ${device.viewport.height}</span>
          </h1>
          <img alt="${cleanNames(device.name)}" src="./${cleanNames(device.name)}.png" style="border: 2px solid black; max-width: 500px;">
        </div>
      </div>
      `;
});

const htmlContent = `