@uppercod/css-to-object
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @uppercod/css-to-object

Weekly Downloads

2,264

Version

1.1.1

License

ISC

Unpacked Size

6.56 kB

Total Files

6

Last publish

Collaborators

  • uppercod