Using C# to dynamically generate CSS files

前端 未结 4 808
暖寄归人
暖寄归人 2021-01-05 10:07

I have a site that gets deployed to over a dozen clients. The main website has a base template, and each client has a client folder that overrides the colours. The problem i

4条回答
  •  無奈伤痛
    2021-01-05 10:56

    This is entirely possible. You might want to consider cascading your stylesheets too, so that the dynamic one imports a (presumably larger) static one.

    Asp.NET has support for themes, too, but to be honest CSS is much more powerful.

    Why are you thinking ASCX instead of ASPX though? I'd have thought that since one css file represents an entire response, it could all fit in a page.

    an ashx is probably the lightest, fastest form of handler you can implement, so you might want to look at that...

    Oh and make sure you get your caching parameters right!

提交回复
热议问题