Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A generic swappable back-end for JS minifiers
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
report
spec
.gitignore
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
multi_js.gemspec

README.md

MultiJs Build Status Dependency Status Code Climate

There are lot of Ruby libraries to minify JS. Instead of choosing a single implementation and forcing users of your library to be stuck with it, you can use MultiJs instead, which will simply choose the best available JS minifier. Here's how to use it:

require 'multi_js'

MultiJs.compile('(function(){var long_name=1}())') #=> '(function(){var a=1}())'

The use method, which sets the MultiJs adapter, takes either a symbol or a class (to allow for custom JS minifier) that responds to .min at the class level.

MultiJs tries to have intelligent defaulting. That is, if you have any of the supported engines already loaded, it will utilize them before attempting to load any. It will load libraries in following order:

If no other library is available, MultiJs falls back to uglifier.

TODO

  • Implement report:publish rake task
  • Add desciption and some design to report. Put it all in separate folder
  • benchmark against most popular JS frameworks (speed, size)
  • generate benchmark report (html or md)
  • write test suite

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Something went wrong with that request. Please try again.