This question is locked. New answers and comments are not allowed.
I would like to compress css files for themes as well and have come up with a solution but I think it is really ugly and wanted to know if anyone knows of a cleaner way of doing it. I have the code below in my master file. It just loops through the controls in the head section looking for paths:
<script runat="server"> |
protected override void OnLoad(EventArgs e) |
{ |
foreach (var link in Page.Header.Controls.OfType<HtmlLink>().ToList()) |
{ |
if (!link.Href.Contains("App_Themes")) continue; |
Html.Telerik().StyleSheetRegistrar().StyleSheets(styles => |
styles.AddGroup(this.Page.Theme + "Theme", group => |
group.Add(link.Href) |
.Combined(true) |
.CacheDurationInDays(365) |
.Compress(true) |
) |
); |
// Remove original link from header |
link.Parent.Controls.Remove(link); |
} |
} |
</script> |