UGLIFYJS
UGLIFYJS is a code compression tool built on the NODEJS server, which is currently compressed by jquery and has a better compression effect.
GitHub Home: http://github.com/mishoo/UglifyJS/
Online use: HTTP://MARIJNHAVERBEKE.NL/UGLIFYJS
How to use:
- Download Nodejs from http://nodejs.org and use Node.exe
- and download its latest version from UGLIFYJS's GitHub home page.
- Copy Node.exe to Uglifyjs bin directory
- Modify BIN\UGLIFYJS, require ("Uglify-js") to require (". /uglify-js "), if the hint can not find uglify-js words
- Run node uglifyjs–o fancyValidate.min.js fancyvalidate.js
Note The-o parameter is specified first, followed by the compressed file name followed by the-o parameter, and finally the source file.
If you don't have trouble downloading it, use it directly on the online version.
Microsoft Ajax minifier
Microsoft Ajax Minifier is a Microsoft-produced code compression tool that supports JavaScript and CSS code compression.
Official homepage: http://ajaxmin.codeplex.com/
Download and install, the use of the method is also very simple:ajaxmin fancyvalidate.js –o fancyValidate.min.js
For more parameter usage see the official documentation: Http://ajaxmin.codeplex.com/wikipage?title=Command-Line%20Switches
Google Closure Compiler
Google produced a code compression tool that requires the support of JRE (downloaded from http://www.java.com/zh_CN/download/)
Official homepage: http://code.google.com/p/closure-compiler/
First install JRE, simple use:java-jar compiler.jar --js hello.js --js_output_file Hello-compiled.js
For more parameter descriptions please see the relevant documentation: Https://developers.google.com/closure/compiler/docs/overview
YUI Compressor
The Yahoo!ui team's Code compression tool, which supports JavaScript and CSS code compression, also requires JRE support.
Official homepage: http://developer.yahoo.com/yui/compressor/
GitHub Home: Https://github.com/yui/yuicompressor
Download it from http://yuilibrary.com/download/yuicompressor/, simple to use:java-jar yuicompressor-2.4.7.jar myfile.js - o myfile-min.js
For more information, see the official homepage or Https://github.com/yui/yuicompressor/blob/master/doc/README
Packer
The famous JS Daniel Dean Edwards writes the compression tool, the compression ratio is also relatively high.
Official homepage: http://dean.edwards.name/packer/
Time is relatively long, but still useful, but also provides a lot of parameter settings.
Jsmin
With the Packer era, only the annotation, blank and so on compression.
Official homepage: http://www.crockford.com/javascript/jsmin
Provides a DOS command line version: Http://www.crockford.com/javascript/jsmin.zip
Simple to use:jsmin <fancyvalidate.js> fancyValidate.min.js
End
It's a simple introduction to this, and it's best to use JSLint (http://www.jslint.com/) to check your code before you compress it, or it may cause compression to fail.
Author: Embarrassing month