Class Juicer::Minifyer::YuiCompressor
In: lib/juicer/minifyer/yui_compressor.rb
Parent: Object

Provides an interface to the YUI compressor library using Juicer::Shell::Binary. The YUI compressor library is implemented using Java, and as such Java is required when running this code. Also, the YUI jar file has to be provided.

The YUI Compressor is invoked using the java binary and the YUI Compressor jar file.

Providing the Jar file (usually yuicompressor-x.y.z.jar) can be done in several ways. The following directories are searched (in preferred order)

 1. The directory specified by the option :bin_path
 2. The directory specified by the environment variable $YUIC_HOME, if set
 3. Current working directory

For more information on how the Jar is located, see +Juicer::Minify::YuiCompressor.locate_jar+

Author:Christian Johansen (christian@cjohansen.no)
Copyright:Copyright (c) 2008-2009 Christian Johansen
License:MIT

Usage example =

yuic = Juicer::Minifyer::YuiCompressor.new yuic.java = "/usr/local/bin/java" # If ‘java’ is not on path yuic.path << "/home/user/java/yui_compressor/" yuic.save("", "")

Methods

Included Modules

Juicer::Minifyer::JavaBase Juicer::Chainable

Public Class methods

Public Instance methods

Compresses a file using the YUI Compressor. Note that the :bin_path option needs to be set in order for YuiCompressor to find and use the YUI jar file. Please refer to the class documentation for how to set this.

file = The file to compress output = A file or stream to save the results to. If not provided the

         original file will be overwritten

type = Either :js or :css. If this parameter is not provided, the type

       is guessed from the suffix on the input file name

[Validate]