@uppercod/css-to-object
v1.1.1
Published
css-to-json is a package that transforms the syntax from css to JSON format using regular expressions
Downloads
12,752
Readme
css-to-object
css-to-object is a package that transforms the syntax from css to JSON format using regular expressions
The result is an object that shows properties, selectors and nests, example:
input css
.a {
width: 200px;
.b {
font-size: 100px;
&:hover {
background: teal;
}
}
}
@media (max-width: 200px) {
.b {
font-size: 100px;
}
}
output css
{
":host": {
".a ": {
"width": "200px",
".b ": {
"font-size": "100px",
"&:hover ": { "background": "teal" }
}
},
"@media (max-width: 200px) ": { ".b ": { "font-size": "100px" } }
}
}
Note that the output is encapsulated in a
:host
selector.