views:

131

answers:

3

Is there a version of the Prototype framework that is either packable or already packed at the highest compression level with Dean Edward's packer and is tested to work?

Packer: http://dean.edwards.name/packer/

This is a Google-able question but I don't trust Google over mission-critical stuff. I want the information from the pros.

+1  A: 

I have had excellent results using the YUI-Compressor to compress the prototype framework, even when appending additional files to it before it is compressed. All of my JavaScript and CSS is kept separate for ease of development and then recombined into larger modules and compressed to reduce the number of HTTP requests.

Jason
+4  A: 

Having read Thomas Fuchs' (of scriptaculous fame) recent "Javascript Rocks" book I can tell you that he is not a fan of obfuscating Javascript at all. He is an advocate of serving gzipped javascript as its "the best solution for JavaScript file size, bar none". This is possible by either enabling GZIP on your own server using AddOutputFilterByType or by using the hosted ajax libs on google code.

Main reasons to use GZIP are:

  • 1:4 reduction in size
  • doesn’t remove white space, or alter variable / function names so much easier to debug
  • low performance hit compared to script obfuscation

I know this doesnt actually answer your question, just thought it might be an interesting point to consider.

seengee
gzip compression and minifying script are not mutually exclusive-- for minimum size, one should do both. also, what is the performance hit for minified script? minification is typically done at build time (or simply done offline and checked into release builds), so the only performance impact of minification should be clients loading scripts faster-- from the server's point of view, it's just static script whether minified or not.
Justin Grant
I understand why people can be against obfuscating, however: - I will only obfuscate scripts when they are production-ready. I debug the normal version. - In the source code there will always be links to the unobfuscated scripts (inside comments) in case someone wants to look.I voted up your question because it's interesting and clear.I'd like to both minify and gzip. Since nobody answered and not even the Google seems to be able to help me, I'll have to go through the whole Prototype library and correct the punctuation myself :(
Kaze no Koe
+2  A: 

OK after some struggling here's my solution:

1 Use JSLint to catch all the errors like missing semicolons and other unsightly stuff.

2 There is no step 2. Once I have done that, the result is guaranteed to work with Dean Edward's packer.

Gzipping the packed .js reduces the size even further, yielding LUDICROUS DOWNLOAD SPEED!!!!! (or something). Bye

Kaze no Koe