2 ms·
Dojo's "ShrinkSafe" compresses Javascript, rendering it virtually unreadable and considerably smaller. From the documentation at http://dojotoolkit.org/docs/shr
by wehriam 19y ago
Dojo's "ShrinkSafe" compresses Javascript, rendering it virtually unreadable and considerably smaller. From the documentation at http://dojotoolkit.org/docs/shrinksafe http://dojotoolkit.org/docs/shrinksafe :
To demo our compression system, let's build an example that we want to compress. Here's the listing for infile.js:
function MyClass(){
this.foo = function(argument1, argument2){
var addedArgs = parseInt(argument1)+parseInt(argument2);
return addedArgs;
}
var anonymousInnerFunction = function(){
// do stuff here!
}
}
function MyFunc(){
// this is a top-level function
}
// we've got multiple lines of whitespace here
We run it through the compressor with this command to generate outfile.js:
java -jar custom_rhino.jar -c infile.js outfile.js 2&1
And the contents of outfile.js should now look something like:
function MyClass(){
this.foo=function(_1,_2){
var _3=parseInt(_1)+parseInt(_2);
return _3;
};
var _4=function(){
};
}
function MyFunc(){
}