asp.net – 包中的文件排序 – 已知的库是什么?

在捆绑和缩小中,我已经知道捆绑器将移动某些已知的文件类型 – 因此像jQuery这样的东西将被移到前面.

By default,when files are bundled by ASP.NET they are sorted
alphabetically first,just like they are shown in Solution Explorer.
Then they are automatically shifted around so that kNown libraries and
their custom extensions such as jQuery,MooTools and Dojo are loaded
before anything else.
07000

但在阅读了最近的一个问题:ASP.NET MVC – Bundle Config order,它显示了即使用户指定了加载顺序,文件如何被捆绑器移动,我意识到我不知道这些已知文件类型是什么,或者它们将是ORDER列于.

我从来没有见过一个解释这个的清单,在搜索中,我什么也没想到.

是否有列表显示已知文件类型是什么以及它们将呈现的顺序?我认为这是ASP.NET团队应该为开发人员提供资源的东西.

解决方法

它在BundleCollection.AddDefaultFileOrderings的doc注释中:
/// <summary>
    /// Add default file ordering for common popuular script and style libraries.
    /// </summary>
    /// <param name="list">A collection of <see cref="BundleFileSetordering"/> objects to populate with default values.</param>
    /// <remarks>
    /// The purpose for applying these default file ordering values is to ensure that common libraries such as jquery are always located 
    /// at or close to the top within a bundle. These values can be all removed with <see cref="ResetAll"/>.
    /// 
    /// The default ordering values are as follows:
    /// <list type="bullet">
    ///     <item><description>reset.css</description></item>
    ///     <item><description>normalize.css</description></item>
    ///     <item><description>jquery.js</description></item>
    ///     <item><description>jquery-min.js</description></item>
    ///     <item><description>jquery-*</description></item>
    ///     <item><description>jquery-ui*</description></item>
    ///     <item><description>jquery.ui*</description></item>
    ///     <item><description>jquery.unobtrusive*</description></item>
    ///     <item><description>jquery.validate*</description></item>
    ///     <item><description>modernizr-*</description></item>
    ///     <item><description>dojo.*</description></item>
    ///     <item><description>mootools-core*</description></item>
    ///     <item><description>mootools-*</description></item>
    ///     <item><description>prototype.js</description></item>
    ///     <item><description>prototype-*</description></item>
    ///     <item><description>scriptaculous-*</description></item>
    ///     <item><description>ext.js</description></item>
    ///     <item><description>ext-*</description></item>
    /// </list>
    /// </remarks>
    public static void AddDefaultFileOrderings(IList<BundleFileSetordering> list) {
        if (list == null) {
            throw new ArgumentNullException("list");
        }

        BundleFileSetordering css = new BundleFileSetordering("css");
        css.Files.Add("reset.css");
        css.Files.Add("normalize.css");
        list.Add(css);

        BundleFileSetordering jquery = new BundleFileSetordering("jquery");
        jquery.Files.Add("jquery.js");
        jquery.Files.Add("jquery-min.js");
        jquery.Files.Add("jquery-*");
        jquery.Files.Add("jquery-ui*");
        jquery.Files.Add("jquery.ui*");
        jquery.Files.Add("jquery.unobtrusive*");
        jquery.Files.Add("jquery.validate*");
        list.Add(jquery);

        BundleFileSetordering mod = new BundleFileSetordering("modernizr");
        mod.Files.Add("modernizr-*");
        list.Add(mod);

        BundleFileSetordering dojo = new BundleFileSetordering("dojo");
        dojo.Files.Add("dojo.*");
        list.Add(dojo);

        BundleFileSetordering moo = new BundleFileSetordering("moo");
        moo.Files.Add("mootools-core*");
        moo.Files.Add("mootools-*");
        list.Add(moo);

        BundleFileSetordering proto = new BundleFileSetordering("prototype");
        proto.Files.Add("prototype.js");
        proto.Files.Add("prototype-*");
        proto.Files.Add("scriptaculous-*");
        list.Add(proto);

        BundleFileSetordering ext = new BundleFileSetordering("ext");
        ext.Files.Add("ext.js");
        ext.Files.Add("ext-*");
        list.Add(ext);
    }

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....