I added bundling to my MVC 3 app. I downloaded the nugetpackage for Microsoft.Web.Optiminization.1.1.3 I added this to my Globals.asax
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations = true;
//CSS
var styles = new StyleBundle("~/Bundling/bundledcss").Include(
"~/Content/site.css",
"~/Content/ASPNetSpellInclude/themes/bright/*.css",
"~/Content/ASPNetSpellInclude/themes/buttons/*.css",
"~/Content/ASPNetSpellInclude/themes/classic/*.css",
"~/Assets/CSS/*.css",
"~/Assets/CSS/blue/*.css",
"~/Assets/CSS/cupertino/*.css",
"~/Assets/JQGrid/css/cupertino/*.css"
);
INetLog log = ObjectFactory.GetInstance<INetLog>();
log.Debug("done mini and budle css");
//JS
var js = new ScriptBundle("~/Bundling/bundledjs").Include(
"~/Scripts/*.js",
"~/Content/*.js",
"~/Content/ASPNetSpellInclude/*.js",
"~/Content/ASPNetSpellInclude/core/*.js",
"~/Content/ASPNetSpellInclude/debugging-test-scripts/*.js",
"~/Content/ASPNetSpellInclude/translations/*.js",
"~/Content/ASPNetSpellInclude/*.js",
"~/Assets/JavaScript/*.js",
"~/Assets/JavaScript/i18n/*.js",
"~/Assets/JQGrid/js/*.js",
"~/Assets/JQGrid/js/i18n/*.js"
);
log.Debug("done minify and bundle script");
bundles.Add(styles);
bundles.Add(js);
BundleTable.EnableOptimizations = true;
log.Debug("done generating bundles");
}
Which is called from Application_Start
protected void Application_Start
{
<snip>
RegisterBundles(BundleTable.Bundles);
}
On my root layout page I have these
<link rel="stylesheet" type="text/css" href="@Styles.Url("~/Assets/CSS/Jcdc.css")" />
<script type="text/javascript" src="@Scripts.Url( "~/Assets/JavaScript/jquery-1.4.2.min.js")"></script>
and my web.config has debug = false
<compilation debug="false" targetFramework="4.0">
but when I run and view source on the page... I still see this.
<link rel="stylesheet" type="text/css" href="/CIS3G/Assets/CSS/Jcdc.css" />
...
<script type="text/javascript" src="/CIS3G/Assets/JavaScript/jquery-1.4.2.min.js"></script>
That means that minification and bundling is not working, right?
This article
Shows that I should expect
So it's aparently not working...
Anybody see what I've missed, everything I've read tells me it should be working?