Usage and features

JSXS is in BETA test since 1 april 2009. Its possible the output compressed code not be a comptatible javascript code. Your browser can return a syntax error after the evaluation of it. I really appreciate your taking the time to report an issue.


JSXS require a minimum of php 5.1.0 . works on all plateforms.


compatibility : add semi-colons at the end of block (like function, object...) if necessary. Currently, works only if shrink option is actived.

reduce : removes blank spaces and comments.

shrink : reduces the names of variables to shorter.

concatString : all strings concatenated with the operator of addition are merged.


adding semicolumn if necessary : In javascript language, the end of line can be interpreted as a semicolumn, so your code without blankspace is probably wrong. This feature adds semicolumns for prevent syntax error.

remove multiple and unused semicolumn : Multiple ending semicolumn, and semicolumn before ending block are removed, except in for statements.

remove blankspace and endline : simple and usefull.

reduce variable names : The names of variable in non-global context are reduced to the smallest possible name, with none conflict. It's the same with function names.

concat string : Two string separated by + can be concatened.

see bugs and future features


// uncompressed
function test (arg1) {
  var func = function (arg1) {
    return arg1+2;
  return 'your value' + ' : ' + arg1 + func(arg1);

// compressed
function test(b){var c=function(a){return a+2};return'your value : '+b+c(b)}
  • removed white space.
  • concatened string : 'your value' + ' : ' => 'your value : '.
  • reduced variable names : arg1 => b, func => c, arg1 => a.
  • removed semicolumn : ...func(arg1); => ...c(b).
  • adding semicolumn for compatibility "} return 'your val..." => "};return'your val...".
posted by Evandro Myller at 2009-07-13 07:20:32
hello. i just tested the tool i liked very much the result. unfortunately, i got a syntax error near by here:

... }else if(!c){b=0 break main};b=0};return!!b}, ...

maybe some issue about block labels?
anyway, the compressor looks promising. :)

great work. and please tell me if you have any thoughts, I'm interested in the project. ty, cya.
posted by Kyle Simpson at 2009-07-13 17:23:56
I ran it just now on my project LABjs ( Compared to YUI Compressor, it saved another 77 bytes. Not much, but something I guess.

I'm curious though, why this one instead of YUI Compressor? What are the main benefits?
posted by Xorax at 2009-07-17 21:39:00
@Evandro Myller
After testing, I think it's missing semicolumn before break in your code (yes, in javascript standard, it's not required if there is end of line after it)

@Kyle Simpson
There are many differences. Soon I'll write a table comparaison between JSXS and the other tools.
posted by Evandro Myller at 2009-07-21 11:41:30
Hey, Xorax.
d'oh. I really missed a semicolon there (and in some parts of the code). Now, there are semicolons and I just tested again.

Now, for some reason, it's adding a semicolon to a do{} block; so the interpreter is now asking for a while statement.

note: i just removed this semicolon and the compressed script is working perfectly. And, regardless of this little problem, this is now the official compressor of my JavaScript project, since it did the best job with compression. Thanks. ;)
posted by Xorax at 2009-07-22 01:21:28
There is a bug for the "do-while" statement with the compatibility option. This append because it's very hard to detect difference between "do-while" and only "while". I'll try to fix it in the next release.

Thanks you for debugging :)
posted by Gabriel Gilini at 2009-07-24 03:08:21
Well, it's not that hard if you use lookbehind assertions and/or conditional subpatterns. I just learned about your project, so if you could point me how I can help (is it hosted on GitHub?), I'd gladly try to fix that.

posted by at 2017-05-21 09:22:02
It is perfect time to make some plans for the future and it's
time to be happy. I've learn this publish and if I could I desire to counsel you few fascinating things or tips.
Maybe you could write subsequent articles referring to this
article. I desire to learn even more issues approximately it!