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