Project

defacer

0.0
No commit activity in last 3 years
No release in over 3 years
Favors speed over size of minified JS, works on any ruby platform, works well with the Rails asset pipeline and Sprockets
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Defacer

A pure-Ruby javascript minifier. Currently alpha quality - we do not recommend you use this for production code.

Design goals

  • Be faster than any of the minifiers commonly used in Ruby projects (Uglifier, Closure Compiler, YUI Compressor).
  • Create code that, when gzipped, is no more than 5% larger than the code created by other minifiers.
  • Be written in pure Ruby. Why?
    • It makes it easier for Ruby devs to hack on Defacer and improve it
    • It reduces deployment complexity - no need to have a JVM or a Javascript runtime
    • It's cross-platform for free

Performance

The benchmark.rb script included with the gem compares Defacer to Uglifier and Closure. It measures the size of the minified JS, the size of the minified JS after gzipping, and the speed of the minification. As of June 2014, Defacer is faster than all other minifiers (though not much faster on large input files), but creates code that is 5-25% larger than other minifiers.

Installation

Defacer is distributed as a Rubygem. Add this line to your application's Gemfile:

gem 'defacer'

And then execute:

$ bundle

Using with Rails

Instructions coming soon

Contributing

Pull requests are welcome! Pull requests containing tests are even better!!