0
我使用ExCSS來解析和處理樣式表字符串。到現在爲止還挺好。如何使用ExCSS解析器將StyleRules作爲字符串輸出
但我找不到有關如何將操縱風格規則轉換爲字符串的任何文檔。
儘管代碼可能不是有關這個問題,這是我在做什麼:
private string ManipulateCSS(string styles)
{
ExCSS.Parser parser = new ExCSS.Parser();
var stylesheet = parser.Parse(styles);
// here I perform specific manipulations
// which are not relevant to this question...
stylesheet.StyleRules
.SelectMany(r => r.Declarations)
.Where(d => d.Name == "<something>"
...
...
// Now, the next line is where I'm having issues:
// how to return the whole string with styles out of this ExCSS parser?
return stylesheet.StyleRules.ToString();
}
謝謝您的幫助!