Skip to content

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

License

Notifications You must be signed in to change notification settings

WebReflection/as-css-vars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published