webpack-electroshot-plugin
Webpack plugin for electroshot.
Capture website screenshots with optional device and network emulation as jpg, png or pdf (with web fonts!) using Electron / Chrome.
Install
npm
npm install -D webpack-electroshot-plugin
yarn
yarn add -D webpack-electroshot-plugin
electroshot
npm install -D electroshot// or globalnpm install -g electroshot
Usage
const WebpackElectroshotPlugin = // or
output: path: "/output/path" plugins: // options
API
options
])
class WebpackElectroshotPlugin([options
All options of electroshot are available in camelCase.
See electroshot docs.
Required
- filename
Optional
- delay: default: 1000
- format: default: jpg
- out: default: .
- resolution: default: 1280
- url: default: index.html
- cookie
- css
- device
- download
- emulateNetwork
- forceDeviceScaleFactor
- ignoreCertificateErrors
- js
- latency
- pdfBackground
- pdfMargin
- pdfOrientation
- pdfPageSize
- proxyServer
- quality
- selector
- upload
- userAgent
- zoomFactor
Examples
JPG
Will create BUILD_PATH/screenshot.jpg
:
filename: `screenshot.jpg`
PNG
Will create BUILD_PATH/screenshot.png
:
filename: `screenshot.png` format: 'png'
Will create BUILD_PATH/screenshots/screenshot.pdf
:
filename: `screenshot.pdf` format: 'pdf' out: 'screenshots' pdfBackground: true pdfMargin: 'none' pdfPageSize: 'A4'
Resources
- electroshot - Capture website screenshots with optional device and network emulation as jpg, png or pdf (with web fonts!) using Electron / Chrome.
Authors
- Ricardo Ferro ricardo.ferro@gmail.com
License
MIT