I've been using ASP.NET bundling and minification with the nugget package Microsoft.AspNet.Web.Optimization.
I noticed yesterday that the majority of my bundle files no longer have the v query string parameter to the exception of one of them:
/Sgc.Web/bundles/css/JQueryUI
/Sgc.Web/bundles/css/DefaultPage
/Sgc.Web/bundles/js/Menu
/Sgc.Web/bundles/js/DefaultPage
/Sgc.Web/bundles/js/ReportOutputs
/Sgc.Web/bundles/js/UnderscoreBackbone?v=4YsZ6DBVserabs64GE87Ua4d51aeg0D1wXHWNe3E6NU1
The JS bundle that still has the query string always keeps on producing different v param values after I do changes on it (as expected). However the remaining bundles (either css or js) when I make changes on their css or js files they do incorporate those changes but do not produce a v param value any more.
The C# code to perform the bundling:
// -- create and add CSS bundles without minification
BundleTable.EnableOptimizations = true;
bundles.Add(new Bundle("~/bundles/css/JQueryUI").Include(
"~/Styles/Gui/jquery-ui-1.10.4-custom.css",
"~/Styles/Gui/jquery-ui-custom.css",
"~/Styles/Gui/jquery.ui.combogrid.css"));
bundles.Add(new Bundle("~/bundles/css/DefaultPage").Include(
"~/Styles/Default.css",
"~/Content/toastr.min.css"));
// -- create and add JS bundles without minification
bundles.Add(new Bundle("~/bundles/js/DefaultPage").Include(
"~/Scripts/Defaults.js",
"~/Scripts/toastr.min.js"));
bundles.Add(new Bundle("~/bundles/js/Menu").Include(
"~/Scripts/Gui/Menus/SuperFish/jquery.hoverIntent.r7.min.js",
"~/Scripts/Gui/Menus/SuperFish/superfish1_7_4.min.js",
"~/Scripts/Gui/Menus/SuperFish/factory.js"));
bundles.Add(new Bundle("~/bundles/js/UnderscoreBackbone").Include(
"~/Scripts/underscore.min.js",
"~/Scripts/backbone.min.js"));
bundles.Add(new Bundle("~/bundles/js/ReportOutputs").Include(
"~/Scripts/Gui/jquery-visibility.js",
"~/Scripts/UserControls/ReportOutputs.js"));
//-- if in Release mode, then minify all the bundles
if (!System.Web.HttpContext.Current.IsDebuggingEnabled)
{
CssMinify cssMinify = new CssMinify();
JsMinify jsMinify = new JsMinify();
foreach (Bundle bundle in bundles)
{
if (bundle.Path.Contains("/js"))
{
bundle.Transforms.Add(jsMinify);
}
else
{
bundle.Transforms.Add(cssMinify);
}
}
As can be seen from above I'm building the bundle with the Bundle super class instead of the StyleBundle or ScriptBundle sub classes. However I also tried to make bundles with these 2 subclasses and the result was the same: all bundles still didn't had v param to the exception of the UnderscoreBackbone bundle. As far as I know there is no difference in the way the UnderscoreBackbone bundle is being made and the remaining bundles.
I'm using,
- Windows 8.1
- VS Premium 2013 with Update 1
- Microsoft.AspNet.Web.Optimization 1.1.3
- WebGrease 1.6.0
- Microsoft.Web.Infrastructure 1.0.0.0
- Json.NET (Newtonsoft.Json) 6.0.1
- ANTLRv3 3.5.0.2
Does anyone ever faced this kind of problem before or any hint as to where can I look for a solution to it ?
Thanks in advance,
MggLp
if (!System.Web.HttpContext.Current.IsDebuggingEnabled)...
and replace withbundles.Add(new ScriptBundle
andbundles.Add(new StyleBundle
. Also ensure any bundle name also doesn't have the same name as a directory. It's safer to use~/bundles/bundleName
to ensure no conflict. And your src names don't seem to match up with your bundle names. Please show how you are referencing bundles. – MikeSmithDev