Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/toastxc/toml-css
Converts a hierarchical TOML based CSS to standard CSS properties
https://github.com/toastxc/toml-css
Last synced: 20 days ago
JSON representation
Converts a hierarchical TOML based CSS to standard CSS properties
- Host: GitHub
- URL: https://github.com/toastxc/toml-css
- Owner: toastxc
- License: lgpl-3.0
- Created: 2022-11-15T04:35:12.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-15T12:15:24.000Z (about 2 years ago)
- Last Synced: 2024-11-24T20:53:39.659Z (about 1 month ago)
- Language: Rust
- Homepage:
- Size: 38.1 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: COPYING.LESSER
Awesome Lists containing this project
README
TOML-CSS
An alternate for normal CSSTOML-CSS converts structured .toml files into CSSv3 compliant text files
# Example
Every CSS object is deserialized using a struct (yes there is a struct for every CSS property).
```rust
// add to here to create new items in
#[derive(Serialize, Deserialize, Default, Debug)]
pub struct CsStruct {
pub example_div: RsCSS,
}
```Once your object is named with the type RsCSS (short for Rust CSS) you can create an TOML config with the same name
```toml[example_div]
# for more complex statements a dot can be used
border.style="solid"
border.left={color="blue", width="2px"}
border.right={color="red", width="4px"}# OR
[example_div]
border={style="solid", left={color="blue", width="2px"}, right={color="red", width="4px"}}```
If the TOML is valid, it will be compiled to normal CSS
```css
example_div {
border-left-color: blue;
border-left-width: 2px;
border-right-color: red;
border-right-width: 4px;
border-style: solid;
}
```# The purpose of TOML-CSS
I wanted a way to quickly create CSS for Rust based frameworks without using the default structure for CSS while still remaining 100% compatible with vanilla CSS.
I liked the idea of CSS with more structure but couldn't find anything for rust so I made my own![LGPLv3 Badge](/README_RESOURCES/LGPLv3%20Logo.svg)