1.0.3 • Published 6 years ago

object-style v1.0.3

Weekly downloads
15
License
MIT
Repository
github
Last release
6 years ago

object-style

Convert style objects into CSS rules and classNames

  • Framework agnositic
  • One dependency
  • Small (< 0.8 kb)
  • Supports pseudoclasses
  • Supports media queries
npm i object-style
import objectStyle from 'object-style'

const { className, css } = objectStyle({
  color: 'magenta',
  backgroundColor: 'cyan',
  fontSize: '48px',
  '@media screen and (min-width:40em)': {
    fontSize: '64px'
  },
  '&:hover': {
    color: 'black'
  },
  '@media screen and (min-width:56em)': {
    '&:hover': {
      color: 'navy'
    }
  }
})

MIT License