"An error occurred while trying to compress javascript text."<p>Hmmm....<p>Firstly I think I gave it too much JS code to deal with and it choked (about 3,000 lines).<p>Running it twice in a row always causes it to fail in my experience so far.<p>I am not quite sure what it is trying to do. I get a little report like:<p>Original file size : 1,009bytes
JSMin : 706bytes (30%)
UglifyJS : 644bytes (36%)
YUI Compressor : 647bytes (35%)
Closure Compiler : 638bytes (36%)<p>but no sign of the compressed code except the code I enter has most new lines removed. The newlines between function declarations are maintained.<p>The above report I pasted inline is after I asked for one algorithm to be tested (Closure Compiler) but it reported on all of them.<p>This is a good idea, and it would be useful if:<p>(a) it could cope with 3,000 lines about 120K. That is not much<p>(b) Gave me a bit more information about what the compression is doing. I care about more than the sizw. At the very least show me the compressed code.<p>(c) Let me test one algorithm at a time<p>peace
W
Wow, great idea. I wish this was available as a npm package.<p>A couple of things, sometimes the service doesn't work and returns "YUI Compressor : 0bytes (100%)" or "JSMin : 886bytes (0%)". A typo: succees.<p>The references section could be expanded with resources about writing JS code in a way that enables optimizations:<p><a href="http://toddmotto.com/what-function-window-document-undefined-iife-really-means/" rel="nofollow">http://toddmotto.com/what-function-window-document-undefined...</a><p><a href="https://curiosity-driven.org/minimal-loader" rel="nofollow">https://curiosity-driven.org/minimal-loader</a>
Pretty cool, but comparing file sizes probably isn't enough.
We should also compare the file sizes after gzipping. smaller js files doesn't necessarily mean smaller zipped files.<p>Also, size comparison ignores speed improvements due to load time and runtime optimizations that closure compiler does and uglify doesn't. (Although you'll have to use ugly code annotations to get closure compiler to do its magic).
Nice one, thanks for sharing!<p>I've been researching for a minifier recently and on my tests Closure Compiler always win on the file size metric. However, due to the Closure Compiler Java dependency, I'll likely choose UglifyJS (which is always the second best on my tests).<p>Have you noticed cases where Closure Compiler or UglifyJS aren't the best?
I fixed many of the bugs happening on the site, and there's much less traffic now, so if someone didn't get a chance to see it, you can come back now :)
This looks like it might have been an interesting submission, but I'm getting a bad gateway error when clicking through.<p>Also, you should re-title it as Show HN to get better visibility!<p>EDIT: author has fixed it.