How to compress javascript? [duplicate]
Possible Duplicate:
How can I obfuscate JavaScript?
Hi,
I want to compress a JavaScript code but not just to remove whitespaces also I want to change all variable names to unintelligible names. How can I provide this ?
Thanks in advance,
Compressing is one thing, and the process of changing variable names to unintelligible names is called obfuscation. For that, you will need to use a javascript obfuscator or yuicompressor which does both.
Similar question(s) on SO.
- How can I obfuscate javascript?
just to add a bit http://code.google.com/closure/ can also be used
I recommend YUI compressor.
Online Javascript compressor
Either of the following will serve you well:
http://code.google.com/closure/ and http://developer.yahoo.com/yui/compressor/
I'm quite fine with yuicompressor that obfuscate also
http://www.crockford.com/javascript/jsmin.html
http://jscompress.com/
http://developer.yahoo.com/yui/compressor/
I dont know if you tried googling it but this what i use:
Javascript Compressor
It is a good idea to have your code pass in JSLINT first to assure it works
Or Uglify, an alternative to YUI compressor that requires node.js.
That is called obfuscation. Check out this question.
精彩评论