Get started with cssobj CDN
MIT licensed
CSSObj: Node.js library, simplifies CSS object manipulation and querying.
Tags:- cssinjs
- css-in-js
- css in js
- cssom
- auto-prefixer
- css generate
- diff css
- css modules
Stable version
Copied!
How to start using cssobj CDN
// Include the cssobj library
const cssobj = (() => {
const script = document.createElement('script');
script.src = 'https://cdn.cdnhub.io/cssobj/1.3.6/cssobj.min.js';
document.head.appendChild(script);
return new Promise((resolve) => {
script.onload = () => {
document.head.removeChild(script);
resolve(window.CSSObj);
};
});
})();
// Define a CSS object
const myStyles = {
'body': {
'color': 'white',
'background-color': 'black'
},
'.my-class': {
'color': 'red'
}
};
// Apply the CSS object to the document
async function applyStyles() {
await cssobj;
cssobj.apply(document.documentElement, myStyles);
}
applyStyles();
Copied!
Copied!