1

I am using John Papa's SPA jump start App to create my own app and for every part of his tutorial I complete I keep running into the same problem.

In a new section of the tutorial I have to add another javaScript file and to this I use BundleConfig.cs. I copy and paste the .Include method and add the new JS file. But in firebug I can't see the script in the network tab.

using System;
using System.Web.Optimization;

namespace AgencyUpdate
{
    public class BundleConfig
    {
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.IgnoreList.Clear();
            AddDefaultIgnorePatterns(bundles.IgnoreList);

            bundles.Add(
                new ScriptBundle("~/scripts/modernizr")
                    .Include("~/scripts/modernizr-{version}.js"));

            bundles.Add(
              new ScriptBundle("~/scripts/vendor")
                .Include("~/scripts/jquery-{version}.min.js")
                .Include("~/scripts/bootstrap.min.js")
                .Include("~/scripts/knockout-{version}.js")
                .Include("~/scripts/sammy-{version}.js")
                .Include("~/scripts/moment.min.js")
                .Include("~/scripts/Q.js")
                .Include("~/scripts/breeze.min.js")
                .Include("~/scripts/toastr.js"));

            bundles.Add(
             new StyleBundle("~/Content/css")
                .Include("~/Content/ie10mobile.css") // Must be first. IE10 mobile viewport fix
                .Include("~/Content/bootstrap.min.css")
                .Include("~/Content/bootstrap-responsive.min.css")
                .Include("~/Content/font-awesome.min.css")
                .Include("~/Content/toastr.css")
                .Include("~/Content/styles.css")
             );
        }

        public static void AddDefaultIgnorePatterns(IgnoreList ignoreList)
        {
            if (ignoreList == null)
            {
                throw new ArgumentNullException("ignoreList");
            }

            ignoreList.Ignore("*.intellisense.js");
            ignoreList.Ignore("*-vsdoc.js");
            //ignoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled);
            //ignoreList.Ignore("*.min.js", OptimizationMode.WhenDisabled);
            //ignoreList.Ignore("*.min.css", OptimizationMode.WhenDisabled);
        }
    }
}

No Breeze!!!!

Is this a bug or quirk of Visual Studio 20120?

nick gowdy
  • 6,191
  • 25
  • 88
  • 157

2 Answers2

0

I had to create a new global.asax file for this to work. There was nothing wrong with my scriptbundles.

nick gowdy
  • 6,191
  • 25
  • 88
  • 157
  • For future Googlers, make sure that both the debug and min files are in the bundle. – onefootswill Jan 19 '14 at 01:11
  • @onefootswill Why exactly do we need to include both the debug and min version for this to work??? I don't like the idea of including both, but including both works. – user1265146 Mar 12 '14 at 05:31
0

I was trying to use jquery.loadmask.min.js and faced the same problem.

The solution is,

  • Rename jquery.loadmask.min.js to jquery.loadmask-0.4.min.js
  • Rename jquery.loadmask.js to jquerym.loadmask-0.4.js

Now in Script bundle add the files as following, bundles.Add(new ScriptBundle("~/bundles/jqueryloadmask"). Include("~/Scripts/jquery.loadmask-{version}.js"));

Hemanshu Shah
  • 151
  • 2
  • 2