asp.net mvc脚本包添加所有文件(asp.net mvc script bundle adding all the files)

编程入门 行业动态 更新时间:2024-10-26 22:16:46
asp.net mvc脚本包添加所有文件(asp.net mvc script bundle adding all the files)

当您添加脚本包并具有以下内容时:

bundles.Add(new ScriptBundle("~/bundles/base.scripts").Include( "~/Scripts/jquery-1*"));

它加载原始Jquery版本和缩小版本。 这些文件都在Scripts文件夹中,因此我假设星号正在完成您所说的内容。

有没有办法在debug = false模式下只有缩小版本渲染,而在debug = true中的原始版本?

或者是实际指定您想要的文件而不是使用星号?

问候,雅克

When you add a script bundle and have something like:

bundles.Add(new ScriptBundle("~/bundles/base.scripts").Include( "~/Scripts/jquery-1*"));

It loads up the raw Jquery version and the minified version. Those files are both in the Scripts folder so I assume the asterisk is doing exactly what you tell it.

Is there a way to have only the minified version render when in debug=false mode and the raw version in debug=true?

Or is it down to actually specifying the exactly files you want instead of using the asterisk?

Regards, Jacques

最满意答案

这应该通过BundleCollection的FileExtensionReplacementList自动发生,当调试= false时,应该选择文件的.min版本。 创建新项目时的默认模板也应该使用此功能。

This should be happening automatically via the BundleCollection's FileExtensionReplacementList which should be selecting the .min version of the file when debug=false. The default templates when you create a new project should be using this functionality as well.

更多推荐

本文发布于:2023-07-26 02:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1269959.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   文件   net   mvc   asp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!