0

I have the following error on my single page app:

http://screencast.com/t/sEYhyowXTqxR

Therefore the page looks ugly.

My bundleconfig.cs I havent modified it:

 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")
              );

            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/styles.css")
             );
        }

and my VS: (everything looks fine to me)

http://screencast.com/t/TQFAPCEsV

Update:

This happened when I changed debug mode to false on web.config, when debug mode is true the webpage renders fine and no error is shown on the network tab

Luis Valencia
  • 32,619
  • 93
  • 286
  • 506

1 Answers1

9

Try this

Bundling and Minification happens only when debug=false

http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification

Make sure you've registered bundles in Global.asax.

protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

        }

Make sure you have all required dll references.

System.Web.Optimization.dll

WebGrease.dll

Antlr3.Runtime.dll

And all css files should in specified valid folder.

UPDATE

Make sure that the virtual path for the bundle (the parameter of the StyleBundle constructor) doesn't match a folder in the filesystem

malkam
  • 2,337
  • 1
  • 14
  • 17
  • I have all 3 dlls, and in the global.asax I have this: BundleConfig.RegisterBundles(BundleTable.Bundles); – Luis Valencia Aug 06 '14 at 10:40
  • 3
    Make sure that the virtual path for the bundle (the parameter of the StyleBundle constructor) doesn't match a folder in the filesystem. – malkam Aug 06 '14 at 10:47
  • that was the problem thank you, the font awesome nuget package creates a folder under content called css. – Luis Valencia Aug 06 '14 at 10:51