ruby-yui is a ruby wrapper for the YUI Compressor.

Install Thor Tasks

thor install github.com/coryodaniel/ruby-yui/raw/master/task.thor

Usage

# this also takes a options hash, defaults are stated below yui = Yui.new “./path/to/javascripts” yui = Yui.new “./path/to/javascripts”, :out_path => “./public/javascripts” yui = Yui.new “./path/to/javascripts/application.js” yui = Yui.new “./path/to/javascripts/.my.cool.glob..js”

# to compress yui.minify Yui.compress_string(“alert(‘hello world’);”) # => true|false if 100% of files where minified

# to compress & bundle yui.bundle # => path to bundle OR nil if failed to bundle

Quick Usage

# This does the same thing as instantiating a Yui object and calling minify # it also takes the same params hash

Yui.compress “./test/data/javascripts” # => true|false

Default Options

:clobber        => false,
:java_cli       => "java -jar",
:yui_jar        => File.join(YUI_ROOT,"ext","yuicompressor-2.4.2.jar"),
:suffix         => "yui-min",
:out_path       => nil,   #file_path.sub(inpath,outpath)
:type           => :js,
:charset        => nil,
:preserve_semi  => false,
:disable_opt    => false,
:nomunge        => false