1.1.1 • Published 3 years ago

@uppercod/css-to-object v1.1.1

Weekly downloads
1
License
ISC
Repository
github
Last release
3 years ago

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.