Macro sauron::prelude::jss::jss_ns [−]
macro_rules! jss_ns {
($namespace : tt, $($tokens : tt) +) => { ... };
}
Expand description
Create a css string using json notation and use namespace on the class selectors
use jss::units::percent;
let css = jss::jss_ns!("frame",
".": {
display: "block",
},
".layer": {
background_color: "red",
border: "1px solid green",
},
"@media screen and (max-width: 800px)": {
".layer": {
width: percent(100),
}
},
".hide .layer": {
opacity: 0,
},
);
let expected = r#".frame{display:block;}.frame__layer{background-color:red;border:1px solid green;}@media screen and (max-width: 800px){.frame__layer{width:100%;}}.frame__hide .frame__layer{opacity:0;}"#;
assert_eq!(expected, css);