新的ScriptBundle .Include不适用于breeze.min.js [英] New ScriptBundle .Include not working for breeze.min.js

查看:77
本文介绍了新的ScriptBundle .Include不适用于breeze.min.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用John Papa的SPA快速启动应用程序来创建自己的应用程序,对于他的教程的每一部分,我都会遇到相同的问题.

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.

在本教程的新章节中,我必须添加另一个javaScript文件,并在其中使用BundleConfig.cs.我复制并粘贴.include方法,然后添加新的JS文件.但是在萤火虫中,我无法在网络"标签中看到该脚本.

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

这是Visual Studio 20120的错误或怪癖吗?

Is this a bug or quirk of Visual Studio 20120?

推荐答案

我必须创建一个新的global.asax文件才能使其工作.我的脚本捆绑包没有错.

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

这篇关于新的ScriptBundle .Include不适用于breeze.min.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆