javascript - 将 "min.js"文件放入 MVC 包中是否有意义?

标签 javascript c# asp.net-mvc performance bundling-and-minification

BundleConfig.cs 中使用 MVC 捆绑时,.js 文件被缩小了,对吧?

如果我使用 min.js 会怎样?这是好事还是坏事?为什么?

bundles.Add(new ScriptBundle("~/bundlesJs/scroller").Include(
    //"~/Scripts/Common/scroller-dataTables.scroller.min.js" // .min version
    "~/Scripts/Common/scroller-dataTables.scroller.js") // not .min version
);

最佳答案

.min 表示脚本文件的缩小版本。 缩小不是压缩。它指的是删除空格和其他非必要字符(如注释),以便代码仍然有效但尽可能紧凑。

因此,不推荐用于开发,因为它会降低代码的可读性和编辑难度。

Minified code is still valid code in all respects and can be run immediately.

Minification happens anyway as part of the compilation process in most languages. By pre-minifying the files, you simply speed up the download and parsing process by a certain amount.

关于javascript - 将 "min.js"文件放入 MVC 包中是否有意义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36282569/

相关文章:

javascript - 查明提交的是哪个 html 表单

javascript - 使用 2 个小数位格式化货币值并将负值更改为红色

c# - 在 C# 中使用 MimeKit 获取字节数组中的附件

javascript - 如何在MVC中的脚本中获取ViewData?

c# - 传递实体,从 View 到 Controller

javascript - 使用 jQuery 和 PHP 从 MySQL 数据库查询的 JSON 数据填充 HTML 选择字段

javascript - 如何在jade中访问js数组的数据

c# - 使用第一条消息的提示保存用户提供的号码?

c# - 给类点击事件 C#

c# - MVC 重定向到没有 Controller 的 View