开发者

Minifiable version of Prototype

Is there a version of the Prototype framework that is either packable or already packed at the highest compression level with Dean开发者_如何学Go 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.


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜