pub struct CssManager { /* private fields */ }
Expand description
CssManager struct allows to attach new css stylesheets to the application.
Using CssManager directly is not recommended, insted use the css_styleseet macro.
To attach css as a stylesheet directly, call the attach_css method with a correct CSS string as an argument. The selectors will be prepended with a newly generated id and the resulting CSS will be added to the application as a new style tag. The method will return the Css object, which can be used to reference the stylesheet selectors inside the rsx macro.
§Example usage
use wal_css::css_manager::CssManager;
let manager = CssManager::new();
manager.attach_css(".class1 { background-color: red; }");
Implementations§
Source§impl CssManager
impl CssManager
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates new instance of CssManager struct.
§Example usage
use wal_css::css_manager::CssManager;
let manager = CssManager::new();
Sourcepub fn attach_css(&mut self, css: &str) -> Css
pub fn attach_css(&mut self, css: &str) -> Css
Attaches css string passed as an argument as a new stylesheet. The selectors will be prepended with a newly generated id and the resulting CSS will be added to the application as a new style tag. The method will return the Css object, which can be used to reference the stylesheet selectors inside the rsx macro.
§Example usage
use wal_css::css_manager::CssManager;
let manager = CssManager::new();
manager.attach_css(".class1 { background-color: red; }");