【问题标题】:How to minify CSS and JS files using BundleConfig如何使用 BundleConfig 缩小 CSS 和 JS 文件
【发布时间】:2021-07-08 20:03:46
【问题描述】:

我一直在尝试使用 ASP.NET MVC 4.6 Bundle Config 来捆绑和缩小我的本地 CSS 和 JS 文件。 我已尝试使用以下代码进行 CSS 捆绑:

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

        bundles.Add(new StyleBundle("~/Content/css/bundleStylesheets").Include(
                                                    "~/Content/css/custom-select.css",
                                                    "~/Content/css/main.css",
                                                    "~/Content/css/homepage.css",
                                                    "~/Content/css/asset-preview.css",
                                                    "~/Content/css/casestudy.css",
                                                    "~/Content/css/admin.css",
                                                    "~/Content/css/judgework.css",
                                                    "~/Content/css/submissions.css",
                                                    "~/Content/css/gallery.css"));

        BundleTable.EnableOptimizations = true;
    }

这将创建一个捆绑 CSS 文件。但是,捆绑文件未缩小。我想知道这是否可能。

谢谢,

【问题讨论】:

    标签: c# asp.net-mvc bundle minify


    【解决方案1】:

    在发布模式下运行您的应用程序并检查发生了什么。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-25
      • 2014-10-04
      • 1970-01-01
      • 2012-01-14
      相关资源
      最近更新 更多