1.0.1 • Published 8 years ago

css2obj v1.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
8 years ago

css2obj

Takes CSS-looking properties as an ES6 tagged template literal and returns an object suitable for styles.registerStyle() in Free-Style.

npm install css2obj

Raw example:

const thirty = 30;
const obj = css2obj`
  position: absolute;
  left: 20px;
  bottom: ${thirty}px;
`;

console.log(obj);
/*
{
  'position': 'absolute',
  'left': '20px',
  'bottom': '30px'
}
*/

Example with Free-Style:

const thirty = 30;

styles.registerStyle(css2obj`
  position: absolute;
  left: 20px;
  bottom: ${thirty}px;
`);