用于比较最小化 Javascript 文件的工具
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8589434/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Tools for comparing minimized Javascript files
提问by J?rgen
I need to compare two minimized Javascript files. Most common diff viewers list differences per line, but this isn't useful when the script is compressed to a few lines.
我需要比较两个最小化的 Javascript 文件。大多数常见的差异查看器会列出每行的差异,但是当脚本被压缩为几行时,这没有用。
Are there any good tools for comparing minimized Javascript files?
有没有比较最小化的 Javascript 文件的好工具?
回答by austincheney
Pretty Diff tool will diff two minified files or a minified to a beautified file with a single button click.
Pretty Diff 工具将通过单击一个按钮来区分两个缩小的文件或一个缩小到一个美化的文件。
It operates by first minifing files to remove comments and the beautifies the source code before running its diff algorithm. This is my tool, so if this does not do what you need I do take requests.
它通过首先缩小文件来删除注释并在运行其差异算法之前美化源代码。这是我的工具,所以如果这不能满足您的需求,我会接受请求。
回答by Umesh Patil
Compressed java script files may not be compared directly. First format both the java script codes using java script beautifier. Then you can compare using any of the below tools:
可能无法直接比较压缩的 java 脚本文件。首先使用java脚本美化器格式化两个java脚本代码。然后您可以使用以下任何工具进行比较:
Tools to compare the code:
比较代码的工具:
- Beyond Compare
- Compare plugin available in Noteapad++
- WinMerge
- Prettydiff
- Kompare
- 超越比较
- 比较 Noteapad++ 中可用的插件
- WinMerge
- 漂亮的差异
- 孔帕雷
Tools to Format the Javascript: 1. JavaScriptBeautifier.com
格式化 Javascript 的工具: 1. JavaScriptBeautifier.com
All above tools are available on internet and can be searched and downloaded on google.
以上所有工具都可以在互联网上找到,可以在谷歌上搜索和下载。
回答by Ira Baxter
Our SmartDifferencertool compares the code using the language syntax rather than text lines. By doing this, it isn't sensitive to or bollixed by formatting or minification.
我们的SmartDifferencer工具使用语言语法而不是文本行来比较代码。通过这样做,它对格式化或缩小不敏感或受到影响。
It doesn't print "lines" containing differences; rather it prints out the code fragment which is different, whether that fragment covers several lines or is only a fragment in a current line. So it would probably do a good job of this.
它不打印包含差异的“行”;而是打印出不同的代码片段,无论该片段覆盖多行还是仅是当前行中的一个片段。所以它可能会做得很好。
There is a SmartDifferencer specific to each language, and in particular there is one for JavaScript.
每种语言都有一个 SmartDifferencer,尤其是 JavaScript。