css!() { /* proc-macro */ }Expand description
Parses the syntax for writing inline css. Every call to css! will have its class name incremented by one.
So your first css! call is class “._css_rs_0”, then “._css_rs_1”, etc.
To write your css to a file use:
ⓘ
OUTPUT_CSS=/path/to/my/output.css cargo run my-app§Examples
ⓘ
#[macro_use]
extern crate percy_css_macro;
fn main () {
let class1 = css! {
"
:host {
background-color: red;
}
:host > div {
display: flex;
align-items: center;
}
"
};
let class2 = css! {r#"
:host { display: flex; }
"#};
assert_eq!(class1, "_css_rs_0".to_string());
assert_eq!(class2, "_css_rs_1".to_string());
}