public
Description: Ruby wrapper for the YUI Compressor.
Homepage: http://github.com/coryodaniel/ruby-yui
Clone URL: git://github.com/coryodaniel/ruby-yui.git
ruby-yui / README
100755 40 lines (32 sloc) 1.219 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
ruby-yui is a ruby wrapper for the YUI Compressor.
 
==== Install Thor Tasks
thor install http://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