wal_css/
lib.rs

1pub mod css;
2pub mod css_manager;
3pub mod id_generator;
4pub mod parser;
5
6/// css_stylesheet macro allows to attach new css stylesheets to the application directly from CSS files.
7///
8/// To attach CSS file as a stylesheet, call the macro providing the relative path to the file.
9/// It will return the [Css](./css/struct.Css.html) object, which can be used to reference the stylesheet selectors
10/// inside the [rsx macro](../wal_rsx/macro.rsx.html)
11///  
12/// # Example usage
13/// ```
14/// use wal_css::css:Css;
15/// use wal_css::css_stylesheet;
16///
17/// thread_local! {
18///     static CSS: Css = css_stylesheet!("path-to-css-file");
19/// }
20/// // ...
21/// CSS.with(|css| {
22///     rsx! {
23///         <div class={format!("{} {}", css["class1"], css["class2"])} />
24///     }
25/// })
26/// ```
27///
28#[macro_export]
29macro_rules! css_stylesheet {
30    ($filepath: expr) => {
31        $crate::css_manager::CssManager::new().attach_css(include_str!($filepath))
32    };
33}