React component to PNG converter, built with Puppeteer
npm i -g repng
repng Icon.js --width 512 --height 512 --out-dir assets
Usage
$ repng <ReactComponent>
Options
-d --out-dir Directory to save file to
-f --filename Specify a custom output filename
-w --width Width of image
-h --height Height of image
-s --scale Scale factor of the image
-p --props Props in JSON format to pass to the React component
-u --puppeteer Props in JSON format to pass to `puppeteer.launch`
--css Path to CSS file to include
--webfont Path to custom webfont for rendering
The CLI detect if your are using this in a repo that is using emotion
or styled-component
. If you need this support
also for the Node API you need to pass in an argument cssLibrary
with the key value emotion
or styled-component
.
MIT License