Macro wasm_css::add_effects

source ยท
macro_rules! add_effects {
    ($style:expr,  $(($fmt:expr, $($arg:expr),*)),*) => { ... };
}
Expand description

Add a effect(s) to the Style with formatting

Effect meaning sub-components to a class like MediaQuery, Hover, Etc.

The ID of the effect becomes its tag component.



add_effects!(style: &mut Style, effect formats) -> Result<(), WasmCssError>

Example Usage:


let mut style = style!("color: red;")?;

add_effects!(
    &mut style,
    (" // Effect ID = &:hover
        &:hover {{
            color: black;
        }}
    ",),
    (" // Effect ID = @media (max-width: 400px)
        @media (max-width: {}px) {{
            font-size: 10rem;
        }}
    ",
        400
    )
)?;