createRenderer([config])

Creates a Fela renderer which renders your selectors, keyframes, fonts and static styles.
It caches all rendered styles to be able to reuse them on future rendering cycles.

Arguments

  1. config (Object?): Optional renderer configuration. The most common use case adding plugins to process styles before they get cached. (See Advanced - Renderer Configuration for further information).

Returns

(Renderer): A Renderer instance.

Example

import { createRenderer } from 'fela'

const rule = props => ({
  backgroundColor: 'red',
  fontSize: props.size,
  color: 'blue'
})

const renderer = createRenderer()

renderer.render(rule, { size: '12px' }) // => a b c


console.log(renderer.renderToString())
// .a{background-color:red}
// .b{font-size:12px}
// .c{color:blue}

results matching ""

    No results matching ""