Stylist is a CSS-in-Rust styling solution for WebAssembly Applications.
Usage
There're two APIs that you can use to style your components.
Style API
To create a stylesheet, you can use [Style::new]:
use Style;
let style = new.expect;
YieldStyle API
Alternatively, any struct that implements [YieldStyle] trait can call
self.style() to get a [Style] instance.
use Cow;
use YieldStyle;
;
Everything that is not in a conditioned block will be applied to the Component the class of this style is applied to.
You may also use Current Selector (&) in CSS selectors to denote the container element:
&}
You can also use other CSS rules(such as: keyframes, supports and media):
{
from }
to }
}
{
}
&}
}
Yew Integration
To enable yew integration. Enable feature yew in Cargo.toml.
Then create a style and use it with yew like this:
use Cow;
use *;
use YieldStyle;
Theming
There're theming examples using Yewdux and yewtil::store.
Features Flags
random: Enabled by default, this flag usesrandcrate to generate a random class name. Disabling this flag will opt for a class name that is counter-based.yew_integration: This flag enables yew integration, which implementsClassesfor [Style] and provides aGlobalcomponent for applying global styles.