css2obj
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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;
`);

Readme

Keywords

none

Package Sidebar

Install

npm i css2obj

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • staltz