stylers/style_sheet/
mod.rs

1mod css_at_rule;
2mod css_style_declar;
3mod css_style_rule;
4mod css_style_sheet;
5
6use crate::{
7    style::{Rule, StyleSheet},
8    Class,
9};
10
11/// This function will build the whole style text as the String.
12/// This build_style is string version of the build_style method from style macro.
13pub(crate) fn build_style(style_str: &str, class: &Class) -> String {
14    let mut style = String::new();
15    let style_sheet = StyleSheet::from_str(style_str, class);
16    style_sheet.rules.iter().for_each(|rule| match rule {
17        Rule::AtRule(at_rule) => style.push_str(&at_rule.css_text()),
18        Rule::StyleRule(style_rule) => style.push_str(&style_rule.css_text()),
19    });
20
21    style
22}