Issue with Bundling and Minification

455 Views Asked by At

I am trying to use the asp.net bundling and minification feature. The issue is when i am including the jquery ui custom script in the bundle than the script is not rendering in my layout page. The code is:

bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
         "~/Scripts/jquery-ui-{version}.custom.js"));

bundles.Add(new StyleBundle("~/content/jquery").Include(
            "~/Content/jquery-ui-{version}.custom.css"));

The above both CSS and script is not including. What am I doing wrong here ?

2

There are 2 best solutions below

1
On

Once you've created the bundles, you'll need to add them to your HTML somewhere. Usually in the _Layout.cshtml, you'll need a line like this:

@Scripts.Render("~/bundles/jqueryui")
0
On

One more option to debug the issue is installing the fiddler and checking the files downloaded while making the request for the webpage Just click on the missing file name in the fiddler and check what is the content returned. In my case it returned the error message Could not load file or assembly WebGrease. I have removed and added the reference and now the script files are rendered.