documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.com/jammit/
MIT License
1.16k stars 197 forks source link

UglifyJS #123

Closed ghazel closed 13 years ago

ghazel commented 13 years ago

File as an idea: Support UglifyJS ( https://github.com/mishoo/UglifyJS ) as a javascript_compressor option.

jQuery recently switched to using it, and reports are that is is faster and produces smaller and less buggy JS.

yfeldblum commented 13 years ago

I'd like this as well. +1

rwz commented 13 years ago

You can try my fork with support of UglifyJS unless you're using Heroku.

For now, uglifier gem depends on therubyracer which does not compile on Heroku.

https://github.com/rwz/jammit

jashkenas commented 13 years ago

As of #132, Jammit now supports UglifyJS. It'll go out properly in the next release.

duncanbeevers commented 13 years ago

Excellent.

juggy commented 13 years ago

Now I can't deploy on heroku... I am not really found of jammit requiring all three engines.

It should check if it is present and throw an error, but not force engines.

yfeldblum commented 13 years ago

+1 for Jammit attempting to require all three libraries, catching the LoadErrors, and testing for defined? constants when deciding if it can use a particular library ... but not sticking them into the runtime_dependencies section of the .gemspec.

Or even splitting Jammit into four gems: jammit with no .gemspec dependencies, jammit-uglify-adapter, jammit-yui-compressor-adapter, and jammit-google-closure-compiler-adapter (with the obvious breakdowns of .gemspec dependencies). This would be a breaking change, but for the better.

rwz commented 13 years ago

i think it would be nice to use something simple pure-ruby like jsmin plus simple regexp css minification by default. So, user who wants better compression just do require needed compressors engines before jammit in Gemfile.

juggy commented 13 years ago

I did a version of jammit that requires no other dependencies than the default YUI.

https://github.com/juggy/jammit/commit/4813bd1ac436df9a84bcaf0c07f8a09c5600e112

If Closure or Uglifier are found, they can be used.