是否可以隔离哪些项目无法捆绑?

时间:2014-04-22 16:19:26

标签: asp.net asp.net-mvc asp.net-mvc-4 iis

我在this question中详述了问题。我已将此问题视为仅在我构建并发布到IIS时出现的问题 - 即使只是我的本地IIS。该网站只能在Visual Studio的IE9中正确呈现。

我的假设是,基于这一点,我的一个(或一些)资产没有正确地建造。但到目前为止,我一直无法确定它们是什么(因为ASP.Net将所有内容连接到bundle文件中)。有没有简单的方法可以找出未包含的内容?

布局中的套装

// Bundles in the header
@Styles.Render("~/bundles/themes/crisp/css")
@Scripts.Render("~/bundles/jquery")
@Styles.Render("~/bundles/less")
@Scripts.Render("~/bundles/modernizr")

// Bundle in the footer
@Scripts.Render("~/bundles/themes/crisp/js")

捆绑配置

public class BundleConfig
{
    // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725

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



    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.IgnoreList.Clear();
        AddDefaultIgnorePatterns(bundles.IgnoreList);


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

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

        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                    "~/Scripts/jquery.unobtrusive*",
                    "~/Scripts/jquery.validate*"));*/

        // Use the development version of Modernizr to develop with and learn from. Then, when you're
        // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
        bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                    "~/Scripts/modernizr-*"));

        /*bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

        bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                    "~/Content/themes/base/jquery.ui.core.css",
                    "~/Content/themes/base/jquery.ui.resizable.css",
                    "~/Content/themes/base/jquery.ui.selectable.css",
                    "~/Content/themes/base/jquery.ui.accordion.css",
                    "~/Content/themes/base/jquery.ui.autocomplete.css",
                    "~/Content/themes/base/jquery.ui.button.css",
                    "~/Content/themes/base/jquery.ui.dialog.css",
                    "~/Content/themes/base/jquery.ui.slider.css",
                    "~/Content/themes/base/jquery.ui.tabs.css",
                    "~/Content/themes/base/jquery.ui.datepicker.css",
                    "~/Content/themes/base/jquery.ui.progressbar.css",
                    "~/Content/themes/base/jquery.ui.theme.css"));*/

        bundles.Add(new StyleBundle("~/bundles/themes/crisp/css").Include(
                   "~/Content/themes/crisp/css/bootstrap.css",
                   "~/Content/themes/crisp/css/style.css",
                   "~/Content/themes/crisp/css/socialicoregular.css",
                   "~/Content/themes/crisp/css/font-awesome.css",
                   "~/Content/themes/crisp/css/hero-equal-thumb-gallery.css",
                   "~/Content/themes/crisp/css/tabs-toggle.css",
                   "~/Content/themes/crisp/css/portfolio.css",
                   "~/Content/themes/crisp/css/blog.css",
                   "~/Content/themes/crisp/css/gallery-folio-masonry.css",
                   "~/Content/themes/crisp/js/fancybox/source/jquery.fancybox.css",
                   "~/Content/themes/crisp/css/header-1.css"));

        bundles.Add(new ScriptBundle("~/bundles/themes/crisp/js").Include(
                    "~/Content/themes/crisp/js/bootstrap.min.js",
                    "~/Content/themes/crisp/js/custom.js"));

        bundles.Add(new LessBundle("~/bundles/less").Include(
                    "~/Content/NSA.less"));
    }
}

如何在Visual Studio中呈现脚本

<!-- in the header -->
<link href="/Content/themes/crisp/css/bootstrap.css" rel="stylesheet"/>
<link href="/Content/themes/crisp/css/style.css" rel="stylesheet"/>
<link href="/Content/themes/crisp/css/socialicoregular.css" rel="stylesheet"/>
<link href="/Content/themes/crisp/css/font-awesome.css" rel="stylesheet"/>
<link href="/Content/themes/crisp/css/hero-equal-thumb-gallery.css" rel="stylesheet"/>
<link href="/Content/themes/crisp/css/tabs-toggle.css" rel="stylesheet"/>
<link href="/Content/themes/crisp/css/portfolio.css" rel="stylesheet"/>
<link href="/Content/themes/crisp/css/blog.css" rel="stylesheet"/>
<link href="/Content/themes/crisp/css/gallery-folio-masonry.css" rel="stylesheet"/>
<link href="/Content/themes/crisp/js/fancybox/source/jquery.fancybox.css" rel="stylesheet"/>
<link href="/Content/themes/crisp/css/header-1.css" rel="stylesheet"/>

<script src="/Scripts/jquery-1.8.2.js"></script>

<link href="/Content/NSA.less" rel="stylesheet"/>

<script src="/Scripts/modernizr-2.6.2.js"></script>

<!-- in the footer -->
<script src="/Content/themes/crisp/js/bootstrap.min.js"></script>
<script src="/Content/themes/crisp/js/custom.js"></script>

如何在IIS中呈现脚本

<!-- in the header -->
<link href="/bundles/themes/crisp/css?v=NGVeO1yylA4mVGqQSoLyRJ2XgdZ-2zTEPUY0ainmzEs1" rel="stylesheet"/>

<script src="/bundles/jquery?v=aLsVjoQ4OTEtRxZ322JRn0RdnugNXJ-_IdXTAvkYpyU1"></script>

<link href="/bundles/less?v=3tti8imykFYimbgfJ7ONprw1J7ZMDbJW1SRykAuV-t81" rel="stylesheet"/>

<script src="/bundles/modernizr?v=wBEWDufH_8Md-Pbioxomt90vm6tJN2Pyy9u9zHtWsPo1"></script>

<!-- in the footer -->
<script src="/bundles/themes/crisp/js?v=gAYGiJLJG_YLR3u47p7oMjS3PzNB2_pXUovgYfVBkv01"></script>

1 个答案:

答案 0 :(得分:1)

所以以'min'结尾的那些脚本不会被捆绑;在你的情况下,bootstrap.min.js不会被捆绑。您必须获得未经授权的版本或重命名。

此外,您可以使用开发人员工具(chrome,IE)并检查是否渲染了所有的csses和js。