asp.netwebformsbundling-and-minificationweb-optimization

How does webopt:bundlereference work in ASP.Net?


In the default template of the ASP.Net web forms for Visual Studio 13, there is a tag webopt:

<webopt:bundlereference runat="server" path="~/Content/css" />

After searching, it seems it is for bundling and minification. Is there any official documentation for the tag? I am unable to find one. Specifically I wanted to know, how does it work? If there is already a minified file in the Content folder, it is taking that file. How can i change that behaviour? How does the path value translate, since there is no folder css inside Content folder?


Solution

  • The webopt element is simply a webforms control for wrapping the bundling and minification from the Microsoft.AspNet.Web.Optimization namespace. It uses WebGrease to do the actual optimization feature.

    I don't think there is a setting though that will let you ignore already minified content. Generally, if it's minified it will use that since it figures it doesn't need to spend the extra time repeating the job.

    The source code is on codeplex as well as some documentation.