Stylers

Installtion

cargo add stylers

Leptos Example

style!

```rust

[component]

fn Hello(cx: Scope, name: &'static str) -> impl IntoView {

let styler_class = style! {"Hello",
    #two{
        color: blue;
    }
    div.one{
        color: red;
        content: raw_str(r#"\hello"#);
        font: "1.3em/1.2" Arial, Helvetica, sans-serif;
    }
    div {
        border: 1px solid black;
        margin: 25px 50px 75px 100px;
        background-color: lightblue;
    }
    h2 {
        color: purple;
    }
    @media only screen and (max-width: 1000px) {
        h3 {
            background-color: lightblue;
            color: blue
        }
    }
};

view! {cx, class = styler_class,
    <div class="one">
        <h1 id="two">"Hello"</h1>
        <h2>"World"</h2>
        <h2>{name}</h2>
        <h3>"Hello Kanna"</h3>
    </div>
}

} ```

style_sheet!

```rust

[component]

fn Hello(cx: Scope, name: &'static str) -> impl IntoView { let classname = stylesheet!("./hello.css"); view! {cx, class = class_name,

"Hello"

"World"

} } - In this casehello.css``` file should be located inside the root directory of the project.

How it works:

Edge cases for style! macro

rust style!( div{ content: raw_str(r#"\hello"#); font: "1.3em/1.2" Arial; } )

Output

css div.l-23432{ content: "\hello"; font: 1.3em/1.2 Arial; }

Optional build process using Trunk