My ASP.NET app has some server-side methods whose results I’d like to inject into my CSS files. For example, rather than hard-code the URL to a logo, I might like to insert a call to MyHelperClass.GetCurrentLogoUrl() in the middle of the CSS file.
If I were writing an ASPX page, I could use code render blocks x (that is, stuff like “<%=MyHelperClass.GetCurrentLogoUrl()%>”) in the middle of my HTML markup. It would be nice to do something similar for CSS.
There are some CSS preprocessing frameworks, e.g. dotless, and they seem to have some cool features, but I’m not aware of any of them supporting making C# calls like this.
You could just make an aspx page and link to it when including a stylesheet. You’ll miss out on css highlighting though.
This has the potential to generate unnecessary overhead though, especially if most properties you’re modifying do not change at runtime. In that case you may want to research TT files which basically generate other files when deployed – in your case, you could have it generate the css with whatever complex logic.