Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 146 lines (106 sloc) 5.203 kB
4acfc31 @jlecomte YUI Compressor
jlecomte authored
1 ==============================================================================
2 YUI Compressor
3 ==============================================================================
4
5 NAME
6
46445be @jlecomte Updated documentation
jlecomte authored
7 YUI Compressor - The Yahoo! JavaScript and CSS Compressor
4acfc31 @jlecomte YUI Compressor
jlecomte authored
8
9 SYNOPSIS
10
d3a7fb7 @jlecomte Updated README
jlecomte authored
11 Usage: java -jar yuicompressor-x.y.z.jar [options] [input file]
12
13 Global Options
09c8d93 @jlecomte Modified readme
jlecomte authored
14 -h, --help Displays this information
15 --type <js|css> Specifies the type of the input file
16 --charset <charset> Read the input file using <charset>
17 --line-break <column> Insert a line break after the specified column number
18 -v, --verbose Display informational messages and warnings
b09f6ea Documentation updated. bump to 2.4.5.
Adam Moore authored
19 -o <file> Place the output into <file> or a file pattern.
b73265b Applied a patch that adds support for wildcard input and output file
Adam Moore authored
20 Defaults to stdout.
d3a7fb7 @jlecomte Updated README
jlecomte authored
21
22 JavaScript Options
09c8d93 @jlecomte Modified readme
jlecomte authored
23 --nomunge Minify only, do not obfuscate
24 --preserve-semi Preserve all semicolons
25 --disable-optimizations Disable all micro optimizations
4acfc31 @jlecomte YUI Compressor
jlecomte authored
26
27 DESCRIPTION
28
46445be @jlecomte Updated documentation
jlecomte authored
29 The YUI Compressor is a JavaScript compressor which, in addition to removing
30 comments and white-spaces, obfuscates local variables using the smallest
31 possible variable name. This obfuscation is safe, even when using constructs
32 such as 'eval' or 'with' (although the compression is not optimal is those
33 cases) Compared to jsmin, the average savings is around 20%.
4acfc31 @jlecomte YUI Compressor
jlecomte authored
34
46445be @jlecomte Updated documentation
jlecomte authored
35 The YUI Compressor is also able to safely compress CSS files. The decision
36 on which compressor is being used is made on the file extension (js or css)
37
38 GLOBAL OPTIONS
4acfc31 @jlecomte YUI Compressor
jlecomte authored
39
40 -h, --help
41 Prints help on how to use the YUI Compressor
42
d03f6ec @jlecomte Misc
jlecomte authored
43 --line-break
59cc12d @jlecomte Changes for 2.1.2
jlecomte authored
44 Some source control tools don't like files containing lines longer than,
45 say 8000 characters. The linebreak option is used in that case to split
46 long lines after a specific column. It can also be used to make the code
47 more readable, easier to debug (especially with the MS Script Debugger)
d895946 @jlecomte Added information about the --line-break option.
jlecomte authored
48 Specify 0 to get a line break after each semi-colon in JavaScript, and
49 after each rule in CSS.
d03f6ec @jlecomte Misc
jlecomte authored
50
a1f2c55 @jlecomte Added info on --type option
jlecomte authored
51 --type js|css
52 The type of compressor (JavaScript or CSS) is chosen based on the
a1026b9 @jlecomte Added support for stdin/stdout. Note that, from now on, the output fi…
jlecomte authored
53 extension of the input file name (.js or .css) This option is required
54 if no input file has been specified. Otherwise, this option is only
55 required if the input file extension is neither 'js' nor 'css'.
a1f2c55 @jlecomte Added info on --type option
jlecomte authored
56
4acfc31 @jlecomte YUI Compressor
jlecomte authored
57 --charset character-set
58 If a supported character set is specified, the YUI Compressor will use it
59 to read the input file. Otherwise, it will assume that the platform's
60 default character set is being used. The output file is encoded using
61 the same character set.
62
63 -o outfile
b73265b Applied a patch that adds support for wildcard input and output file
Adam Moore authored
64
4acfc31 @jlecomte YUI Compressor
jlecomte authored
65 Place output in file outfile. If not specified, the YUI Compressor will
a1026b9 @jlecomte Added support for stdin/stdout. Note that, from now on, the output fi…
jlecomte authored
66 default to the standard output, which you can redirect to a file.
b73265b Applied a patch that adds support for wildcard input and output file
Adam Moore authored
67 Supports a filter syntax for expressing the output pattern when there are
b09f6ea Documentation updated. bump to 2.4.5.
Adam Moore authored
68 multiple input files. ex:
69 java -jar yuicompressor.jar -o '.css$:-min.css' *.css
b73265b Applied a patch that adds support for wildcard input and output file
Adam Moore authored
70 ... will minify all .css files and save them as -min.css
4acfc31 @jlecomte YUI Compressor
jlecomte authored
71
50d3946 @jlecomte Version 2.3 stuffs
jlecomte authored
72 -v, --verbose
73 Display informational messages and warnings.
74
46445be @jlecomte Updated documentation
jlecomte authored
75 JAVASCRIPT ONLY OPTIONS
76
77 --nomunge
78 Minify only. Do not obfuscate local symbols.
79
59cc12d @jlecomte Changes for 2.1.2
jlecomte authored
80 --preserve-semi
81 Preserve unnecessary semicolons (such as right before a '}') This option
82 is useful when compressed code has to be run through JSLint (which is the
83 case of YUI for example)
84
09c8d93 @jlecomte Modified readme
jlecomte authored
85 --disable-optimizations
86 Disable all the built-in micro optimizations.
03460d5 @jlecomte no message
jlecomte authored
87
4acfc31 @jlecomte YUI Compressor
jlecomte authored
88 NOTES
89
a1026b9 @jlecomte Added support for stdin/stdout. Note that, from now on, the output fi…
jlecomte authored
90 + If no input file is specified, it defaults to stdin.
91
b73265b Applied a patch that adds support for wildcard input and output file
Adam Moore authored
92 + Supports wildcards for specifying multiple input files.
93
a1026b9 @jlecomte Added support for stdin/stdout. Note that, from now on, the output fi…
jlecomte authored
94 + The YUI Compressor requires Java version >= 1.4.
4acfc31 @jlecomte YUI Compressor
jlecomte authored
95
00ae788 @jlecomte Version 2.3.2 stuffs
jlecomte authored
96 + It is possible to prevent a local variable, nested function or function
97 argument from being obfuscated by using "hints". A hint is a string that
98 is located at the very beginning of a function body like so:
99
100 function fn (arg1, arg2, arg3) {
101 "arg2:nomunge, localVar:nomunge, nestedFn:nomunge";
102
103 ...
104 var localVar;
105 ...
106
107 function nestedFn () {
108 ....
109 }
110
111 ...
112 }
113
114 The hint itself disappears from the compressed file.
115
ee77a10 @jlecomte Version 2.3.3 stuffs
jlecomte authored
116 + C-style comments starting with /*! are preserved. This is useful with
117 comments containing copyright/license information. For example:
118
119 /*!
120 * TERMS OF USE - EASING EQUATIONS
121 * Open source under the BSD License.
122 * Copyright 2001 Robert Penner All rights reserved.
123 */
124
125 becomes:
126
127 /*
128 * TERMS OF USE - EASING EQUATIONS
129 * Open source under the BSD License.
130 * Copyright 2001 Robert Penner All rights reserved.
131 */
132
a3fbd7c @jlecomte Updated licensing
jlecomte authored
133 MODIFIED RHINO FILES
134
135 YUI Compressor uses a modified version of the Rhino library
136 (http://www.mozilla.org/rhino/) The changes were made to support
137 JScript conditional comments, preserved comments, unescaped slash
138 characters in regular expressions, and to allow for the optimization
139 of escaped quotes in string literals.
140
141 COPYRIGHT AND LICENSE
fe925a7 @jlecomte Updated license information.
jlecomte authored
142
b09f6ea Documentation updated. bump to 2.4.5.
Adam Moore authored
143 Copyright (c) 2011 Yahoo! Inc. All rights reserved.
a3fbd7c @jlecomte Updated licensing
jlecomte authored
144 The copyrights embodied in the content of this file are licensed
145 by Yahoo! Inc. under the BSD (revised) open source license.
Something went wrong with that request. Please try again.