Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 16, 2012 03:26 AM by imran_ku07
Dec 10, 2012 09:03 AM|LINK
Has anyone else reached the limits of the new Bundling and Minification framework?
I've had to build custom bundles and transforms for things that I would have expected out of the box, but the one that's got me banging my head against the wall now is the
media attribute for CSS bundles.
There's no way to set it.
The <link tag is pretty much hard-coded:
private static string RenderCssLink(string path)
return ("<link href=\"" + HttpUtility.UrlPathEncode(path) + "\" rel=\"stylesheet\"/>");
which offers no opportunity for declaring one bundle for screen and another for print.
Microsoft have been mentioning this new bundling and minification framework on almost every occasion that they talk about .NET 4.5, and yet there are several things that other plugins offer which MSFT's version lacks.
And on this occasion (the media attribute) I can't see how I can easily override the default action because the pivotal AssetManager class is declared as 'internal sealed'. So you can't even get around some of the shortcomings.
Dec 12, 2012 05:48 PM|LINK
@awj, see this link stackoverflow.com/.../make-asp-net-bundling-specify-media-screen-for-css-bundle
Dec 12, 2012 06:06 PM|LINK
Thanks, that is indeed useful.
For any future readers of this post, this is the link that's mostly missing from Imran's post.
Imran, as you're obviously one of the devs who worked on the Optimisation Framework (by the look of your blog) can I also suggest something else? I've built my own classes on top of the Optimisation Framework so that I can add virtual paths to a static collection,
then render all references in this collection in a single place (for example, at the bottom of a master page).
This is something that other frameworks offer and I'd like to see it rolled into the MSFT version.
Dec 13, 2012 04:43 AM|LINK
Thanks. But I am just a developers like you. For any suggestion and issues, you can use
this site. I am sure the ASP.NET Optimization team will welcome you.
some new features in pre-releases.
Dec 16, 2012 03:26 AM|LINK
Bundling pre release now support DefaultTagFormat and RenderFormat. See