React component to PNG converter
Clone or download
Latest commit 0a45915 Dec 6, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Adjust CLI pipe Aug 18, 2018
.gitignore Update tests Apr 23, 2018
.npmignore Update tests Apr 23, 2018
CHANGELOG.md Edit changelog Aug 18, 2018
README.md Fix typo Aug 16, 2018
cli.js Add styled-components and emotion support Sep 2, 2018
index.js Add styled-components and emotion support Sep 2, 2018
package-lock.json 3.1.1 Dec 5, 2018
package.json 3.1.1 Dec 5, 2018
test.js Adjust test Apr 23, 2018

README.md

repng

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
  -p --props      Props in JSON format to pass to the React component
  --css           Path to CSS file to include
  --webfont       Path to custom webfont for rendering

Node.js API

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(Component, options)

result.then(streams => {
  console.log('rendered component')
})

Related

MIT License