Package Exports
- css-to-object
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (css-to-object) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
css-to-object
Convert flat CSS rules to JavaScript style objects
Useful for css-in-js libraries
npm i css-to-objectconst cssToObject = require('css-to-object')
const style = cssToObject(`
color: tomato;
padding: 16px;
@media (min-width: 40em) {
paddingLeft: 32px;
paddingRight: 32px;
}
&:hover: {
color: black;
}
& h1 {
font-size: 48px;
}
`, {
camelCase: true,
numbers: true
})
// {
// color: 'tomato',
// padding: 16,
// '@media (min-width: 40em)': {
// paddingLeft: 32,
// paddingRight: 32,
// },
// ':hover': {
// color: 'black'
// },
// h1: {
// fontSize: 48
// }
// }Options
numbers: Converts px values to numberscamelCase: converts CSS properties to camelCased keys