React component to PNG converter
npm i -g repng
repng Icon.js --width 512 --height 512 --out-dir assets
Usage
$ repng <Root-component>
Options
-c --css CSS file to include
-p --props Props to pass to the React component
-w --width Width of image
-h --height Height of image
--crop Crop image to specified height
-s --scale Scale image
-d --delay Delay in seconds before rendering image
-o --out-dir Directory to save file to
-f --filename Name for rendered image
-D --dev Runs a webpack dev server
To preview the component in a dev server, run repng with the --dev
flag
and open http://localhost:8080
repng Icon.js --dev
Running the dev mode might require that you have both webpack and webpack-dev-server installed locally
npm i -D webpack webpack-dev-server
Repng can also be used as a node module.
const repng = require('repng')
const Component = require('./Component')
const options = {
props: {
title: 'hello'
}
}
const result = repng(Comp, options)
result.then(streams => {
console.log('rendered component')
})
MIT License