当前位置: 首页 > 图文教程 > 网络编程 > Javascript > JavaScript 在线压缩和格式化收藏

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 JavaScript 在线压缩和格式化收藏


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 329 ::
收藏到网摘: n/a

国外人写的在线压缩和格式化工具这两套程序都是用纯 JavaScript 写的,可以下载下来离线使用,很方便。

以前在找到过压缩 Javascript 代码的程序,一直在用,感觉效果不错。
http://javascriptcompressor.com/
在线压缩 Javascript 源码
只是把空格、换行、多余的注释等等清理掉,尤其选中 Shrink variables 时,会把长的变量名缩减成单个字母的变量名,压缩比通常能达到50%甚至更小。现在 AJAX 大行其道,JavaScript 文件越来越大,用此压缩应该能减轻不少流量负担。而且缩减变量名后,程序并没有加密,但会使程序变得很难看懂,一定程度上也能保护一下版权吧。

今天又找到了把代码格式化的程序
http://elfz.laacz.lv/beautify/
可以把压缩过的 JS 代码重新格式化成容易阅读的样子。当然如果是 javascriptcompressor.com 压缩时缩减变量名了,是没法恢复原来有意义的变量名的。
遇到特别大的 JS 文件时,浏览器会报耗时过长,选不停止,最终它能完成执行。