as-css-vars

0.1.0 • Public • Published

as-css-vars

Coverage Status Build Status License: ISC

This is a micro-utility to convert a generic object into CSS variables, as string.

// --some-test:someValue;
asCSSVars({someTest: 'someValue'});

// --a:a;--b:b;
asCSSVars({a: 'a', b: 'b'})

// --component-a:a;--component-b:b;
asCSSVars('component', {a: 'a', b: 'b'});

CSS variables can be set all at once on a generic element, since these reflect the cascading property of CSS.

You could use a tiny utility like this to create updates, as shown in this CodePen.

Package Sidebar

Install

npm i as-css-vars

Weekly Downloads

0

Version

0.1.0

License

ISC

Unpacked Size

4.88 kB

Total Files

7

Last publish

Collaborators

  • webreflection