Stylist
Stylist is a CSS-in-Rust styling solution for WebAssembly Applications.
This is a fork of css-in-rust.
Install
Add the following to your Cargo.toml:
= "0.7"
Usage
Style API
To create a stylesheet, use Style::new:
use Style;
let style = new.expect;
If you want to use a custom prefix for your class name,
you can use Style::create.
use Style;
let style = create.expect;
Everything that is not in a conditioned block will be applied to the Component the class of this style is applied to.
The Style you put in will get parsed and converted to actual CSS and automatically appended to the head of your HTML document.
You may also use the & identifier in order to use CSS selectors or pseudo
classes on the styled element:
&}
You can also use other CSS rules, e.g. keyframes:
{
from }
to }
}
{
}
& }
}
YieldStyle API
Alternatively, any struct that implements YieldStyle trait can call
self.style() to get a Style instance.
use Cow;
use YieldStyle;
;
Yew Integration
To enable yew integration. Enable feature yew in Cargo.toml.
Then create a style and use it with yew like this:
use YieldStyle;
Theming
There're theming examples using Yewdux and yewtil::store.