Skip to content
This repository was archived by the owner on Nov 24, 2017. It is now read-only.
jackhand edited this page Jan 30, 2013 · 2 revisions

This page describes how to use Juicer from the command prompt. This page is here out of convenience. However, if you wish to see how to use the version you have installed, it is recommended that you use the following at the command prompt:

juicer merge -h


The following is the syntax on how to use Juicer's merge feature:
Usage: juicer [global options] merge [options] [ARGS]

Combines and minifies CSS and JavaScript files

Each file provided as input will be checked for dependencies to other files, and those files will be added to the final output.

For CSS files the dependency checking is done through regular @import statements.

For JavaScript files you can tell Juicer about dependencies through special comment switches. These should appear inside a multi-line comment, specifically inside the first multi-line comment. The switch is @depend or @depends, your choice.

The -m --minifyer switch can be used to select which minifyer to use. Currently only YUI Compressor and Google Closure Compiler is supported, ie -m yui_compress or (default) or -m closure_compiler. When using the compressor the path should be the path to where the jar file is found.

  • -o, --output file
    Output filename
  • -p, --path path
    Path to compressor binary
  • -m, --minifyer name
    Which minifyer to use. Currently only supports yui_compressor (default), closure_compiler, or ''. If you set the minifyer to '', then the final file will not be minified.
  • -f, --force
    Force overwrite of target file
  • -a, --arguments arguments
    Arguments to minifyer, escape with quotes
  • -i, --ignore-problems
    Merge and minify even if verifyer finds problems
  • -s, --skip-verification
    Skip JsLint verification (js files only). Not recomended!
  • -t, --type type
    Juicer can only guess type when files have .css or .js extensions. Specify js or css with this option in cases where files have other extensions.
  • -h, --hosts hosts
    Cycle asset hosts for referenced urls. Comma separated
  • -l, --local-hosts hosts
    Host names that are served from --document-root (can be given cache busters). Comma separated
    --all-hosts-local
    Treat all hosts as local (ie served from --document-root)
  • -r, --relative-urls
    Convert all referenced URLs to relative URLs. Requires --document-root if absolute URLs are used. Only valid for CSS files
  • -b, --absolute-urls
    Convert all referenced URLs to absolute URLs. Requires --document-root. Works with cycled asset hosts. Only valid for CSS files
  • -d, --document-root dir
    Path to resolve absolute URLs relative to
  • -c, --cache-buster type
    none, soft, rails, or hard. Default is soft, which adds timestamps to reference URLs as query parameters. None leaves URLs untouched, rails adds timestamps in the same format as Rails' image_tag helper, and hard alters file names
  • -e, --embed-images type
    none or data_uri. Default is "none". Data_uri embeds images using Base64 encoding. None leaves URLs untouched. Candiate images must be flagged with '?embed=true to be considered
    --force-image-embed
    Will force all images to embed without having to tag with embed parameter

Global options:

  • -v, --verbose
    Be verbose when outputting info
  • -q, --quiet
    Only log warnings and errors
  • -h, --help
    Show help
    --version
    Show the version of the program

For more info, see: http://cjohansen.no/en/ruby/juicer_a_css_and_javascript_packaging_tool

Clone this wiki locally