Stylist is a CSS-in-Rust styling solution for WebAssembly Applications.
Usage
Yew Integration
To enable yew integration. Enable feature yew_integration in Cargo.toml.
You can create a style and use it with yew like this:
use *;
use styled_component;
Procedural Macros
To create a stylesheet, you can use [style!]:
use style;
let style = style!.expect;
Style API
If you want to parse a string into a style at runtime, you can use [Style::new]:
use Style;
let style = new.expect;
YieldStyle API
Any struct that implements [YieldStyle] trait can call
self.style() to get a [Style] instance.
use Cow;
use ;
;
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 }
}
{
}
&}
}
Theming
There's theming example using Yew Context API.
Features Flags
macros: Enabled by default, this flag enables procedural macro support.random: Enabled by default, this flag usesfastrandcrate 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.