Macro wasm_css::style

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

Construct a Style from a CSS string with formatting

  • Generates random class name if one is not provided, returns WasmCssError if unable to locate Crypto when generating uuid for class name

  • Filters out invalid CSS keys, use style_checked! if you would like to handle invalid CSS



style!(css: &str) -> Result<Style, WasmCssError>

style!(class: &str, css: &str) -> Result<Style, WasmCssError>

Example Usage:


style!(
    "
        gap: {}rem;
        display: flex;
        flex-direction: column;
    ",
    gap_size
)?;