Last post Feb 28, 2018 09:55 AM by Angie xu - MSFT
Feb 22, 2018 10:46 PM|shadowraider00x|LINK
Coming out of my coding hibernation and I took the plunge to jump directly from VS 2008 to VS 2017 and I have a lot of catching up to do. When it comes to bundling and minification in particular, I see a lot of articles out there already and I did read through
some of them. Ithought I understood but when I created a test web application project and it left me totally confused. My questions:
1) I see there is a
Some articles mention some but not others. I guess I just need someone to tell me which of these are elements are interconnected. For example is the BundleConfig.cs somehow programmatically reading the contents of the Bundle.config file? Basically how does
this stuff work ? :)
Feb 22, 2018 11:07 PM|shadowraider00x|LINK
The same bundle seems to be referenced in multiple places (at least to me). Is this not duplication? For example WebFormJs i present under PlaceHolder, ScriptManager and BundleConfig.cs. Can a few of these references be removed?
<%: Scripts.Render("~/bundles/modernizr") %>
<%: Scripts.Render("~/bundles/jquery") %>
<%: Scripts.Render("~/bundles/WebFormsJs") %>
<%: Scripts.Render("~/bundles/MsAjaxJs") %>
<%--To learn more about bundling scripts in ScriptManager see https://go.microsoft.com/fwlink/?LinkID=301884 --%>
<asp:ScriptReference Name="MsAjaxBundle" />
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="bootstrap" />
<asp:ScriptReference Name="respond" />
<asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
<asp:ScriptReference Name="WebFormsBundle" />
public static void RegisterBundles(BundleCollection bundles)
///@@@@@@@@@@@@@@@@@@ Style Bundles @@@@@@@@@@@@@@@@@@@@@@@@
///@@@@@@@@@@@@@@@@@ Script Bundles @@@@@@@@@@@@@@@@@@@@@@@
// Order is very important for these files to work, they have explicit dependencies
// Use the Development version of Modernizr to develop with and learn from. Then, when you’re
// ready for production, use the build tool at https://modernizr.com to pick only the tests you need
Path = "~/Scripts/respond.min.js",
DebugPath = "~/Scripts/respond.js",
<?xml version="1.0" encoding="utf-8" ?>
<include path="~/Content/bootstrap.css" />
<include path="~/Content/Site.css" />
Feb 23, 2018 06:05 AM|Cathy Zou|LINK
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 guess I just need someone to tell me which of these are elements are interconnected. For example is the BundleConfig.cs somehow programmatically reading the contents of the Bundle.config file?
For your question above, This is a .net internal mechanism. it is hard for us to give explanation for this.
You could understand this by refer to the links below:
Feb 23, 2018 07:20 PM|shadowraider00x|LINK
Thank you Cathy, I had already looked at a two of the links you mentioned, but the third one was very informative. What I am trying to find out more on is about the <Script Manager> <Scripts> tag. Is this usage still recommended? Does this do bundling also
in some way?
A default VS 2017 asp.net website auto-created the Script Manager code for me, so it must be useful and doing some thing, I am just not able to find enough information about what it does and why the same references (MsAJaXJs and WebformsJs) are being called
in BundleConfig and ScriptManager at the same time for example. Can you please help with this too?
Feb 28, 2018 09:55 AM|Angie xu - MSFT|LINK
Basically when the ScriptManager tried to load up these scripts, it can load them up from System.Web or the path attribute and eventually in this case, the ScriptManager dedupes the script references and serves the scripts from the path attribute.