jss
This crate provides an easy way to write dynamic css using json notation. This gives you more convenient than you think.
Considering using a dynamic width for our layer class
}
You will have to write it using the format! macro
let width = 10;
let css = format!;
let expected = r#"
.layer {
width: 10px;
}
"#;
assert_eq!;
Ow, we forgot that escaping braces in rust strings is done with braces and we will have double braces all over our dynamic css.
jss! to the rescue:
use *;
let width = 10;
let css = jss!;
let expected = ".layer{width:10px;}";
assert_eq!;