Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uppercod/css-to-object
A lightweight and non-strict CSS parser based on Regular Expressions that generates a lightweight AST, designed for CSS-in-JS
https://github.com/uppercod/css-to-object
Last synced: about 4 hours ago
JSON representation
A lightweight and non-strict CSS parser based on Regular Expressions that generates a lightweight AST, designed for CSS-in-JS
- Host: GitHub
- URL: https://github.com/uppercod/css-to-object
- Owner: UpperCod
- Created: 2020-10-18T20:41:01.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-04T15:22:09.000Z (over 3 years ago)
- Last Synced: 2024-10-28T14:57:00.729Z (8 days ago)
- Language: JavaScript
- Size: 17.6 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
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
```css
.a {
width: 200px;
.b {
font-size: 100px;
&:hover {
background: teal;
}
}
}@media (max-width: 200px) {
.b {
font-size: 100px;
}
}
```## output css
```json
{
":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.