public static string Render(CSS css) { StringBuilder txt = new StringBuilder(); foreach (Import imp in css.Imports) { txt.AppendFormat("{0}\r\n", imp.ToString()); } foreach (MediaTag mtg in css.MediaTags) { txt.AppendFormat("@media{0} {{\r\n", mtg.Media != Media.None ? " " + mtg.Media.ToString() : ""); foreach (Selector sel in mtg.Selectors) { txt.Append(Render(sel, 1)); txt.Append("\r\n"); } txt.Append("}\r\n"); } foreach (Selector sel in css.Selectors) { txt.Append(Render(sel)); txt.Append("\r\n"); } return(txt.ToString()); }
public static string Render(CSS css) { StringBuilder txt = new StringBuilder(); foreach (Import imp in css.Imports) { txt.AppendFormat("{0}\r\n", imp.ToString()); } foreach (MediaTag mtg in css.MediaTags) { txt.AppendFormat("@media{0} {{\r\n", mtg.Media != Media.None ? " " + mtg.Media.ToString() : ""); foreach (Selector sel in mtg.Selectors) { txt.Append(Render(sel, 1)); txt.Append("\r\n"); } txt.Append("}\r\n"); } foreach (Selector sel in css.Selectors) { txt.Append(Render(sel)); txt.Append("\r\n"); } return txt.ToString(); }