Add media type links created by Telerik StyleSheetRegistrar

Can I set the media attribute in a link tag using the Telerik MVC Extensions StyleSheetRegistrar ?

 <%= Html.Telerik().StyleSheetRegistrar() .DefaultGroup(group => group .Add("telerik.common.css") .Add("telerik." + ConfigurationManager.AppSettings["Telerik Theme"].ToLower() + ".min.css")) %> 

I want to add media="screen,handheld" to all the style links created above.

+4
source share
2 answers

No, this is currently not possible. You can change the source code or use vanilla <link /> tags to register CSS files. You don't seem to be using compression or a combination, so using <link /> tags seems doable.

+3
source

In fact, this is possible with a replacement:

 @Html.Raw(Html.Telerik().StyleSheetRegistrar() .DefaultGroup(group => group .Add("default.css") .Combined(true).Compress(true)) .ToHtmlString().Replace(">", " media=\"all\">")) 
+2
source

Source: https://habr.com/ru/post/1316536/


All Articles