Dean Edwards recently released version 3.1 of Packer, his JavaScript compression tool. You’ll be pleased to know I’ve been keeping up with development, and I’ve just released PackR 3.1. PackR is a Ruby version of Packer that can be used from the command line or within Ruby apps.
sudo gem install packr
This release improves compression of local variable names, and adds a couple new features. Firstly, it allows you to compress private variables (denoted by a leading underscore), meaning you can clearly indicate that private methods should not be called as they will have unpredictable numeric names once packed:
Packr.pack("foo._someMethod();", :private => true)
# => "foo._1()"
Secondly, it allows you to protect certain variables from compression. For
example, Prototype uses the magic $super
variable to implement inheritance, so
your code will break if that variable is renamed. You can prevent this by
telling PackR to ignore it:
Packr.pack(code, :shrink_vars => true,
:protect => ['$super'])
Finally, note that PackR is now a gem and not a Rails plugin. Obviously this means you can still use it in Rails, you just need to install it differently.
Give it a spin and let me know how it goes. Any bugs should be reported to me at Github.