12.0.3 • Published 6 years ago
@fela-next/fela-plugin-simulate v12.0.3
fela-plugin-simulate
This plugin can be used to quickly simulate nested style objects such as pseudo classes, media queries or attribute selectors.
Installation
yarn add fela-plugin-simulateYou may alternatively use npm i --save fela-plugin-simulate.
Usage
Make sure to read the documentation on how to use plugins.
import { createRenderer } from '@fela-next/fela'
import simulate from '@fela-next/fela-plugin-simulate'
const renderer = createRenderer({
  plugins: [ simulate() ]
})Example
Input
{
  color: 'red',
  '@media (min-height: 320px)': {
    color: 'green',
    backgroundColor: 'red'
  },
  ':hover': {
    color: 'blue'
  },
  ':active': {
    color: 'yellow'
  }
}rendered with the following props
{
  simulate: {
    ':hover': true,
    ':active': false,
    '@media (min-height: 320px)': true
  }
}Output
{
  backgroundColor: 'red',
  color: 'blue'
}License
Fela is licensed under the MIT License. Documentation is licensed under Creative Common License. Created with ♥ by @robinweser and all the great contributors.