Add YUI Compressor and minify BASH script
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@403 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
226
yuicompressor-2.4.2/doc/CHANGELOG
Normal file
226
yuicompressor-2.4.2/doc/CHANGELOG
Normal file
@@ -0,0 +1,226 @@
|
||||
YUI Compressor 2.4.2, 2008-11-10
|
||||
--------------------------------
|
||||
|
||||
+ Preserved comments shouldn't prevent obfuscation (Thanks to Matjaz Lipus)
|
||||
|
||||
YUI Compressor 2.4.1, 2008-10-28
|
||||
--------------------------------
|
||||
|
||||
+ Use preferentially lower case letters for obfuscated variable names.
|
||||
Since JavaScript keywords use lower case letters most often, this
|
||||
improves the efficiency of any compression algorithm (gzipping)
|
||||
used after minification.
|
||||
+ Don't append a semi-colon at the end of a JavaScript file when the
|
||||
last token is a special comment.
|
||||
|
||||
YUI Compressor 2.4, 2008-10-21
|
||||
------------------------------
|
||||
|
||||
+ Allowed the YUI Compressor (which uses a modified version of Rhino)
|
||||
to work alongside the original (unmodified) rhino library by using
|
||||
a custom class loader.
|
||||
+ Added all that's necessary to build the YUI Compressor to the
|
||||
downloable package.
|
||||
+ Fixed unnecessary white space after return / typeof when possible.
|
||||
|
||||
YUI Compressor 2.3.6, 2008-07-10
|
||||
--------------------------------
|
||||
|
||||
+ Fixed a few minor bugs with the CSS compressor
|
||||
+ Changed packaging. The original Rhino library, which is used to build the
|
||||
YUI Compressor, is not part of the downloadable archive. Too many people
|
||||
put it in their classpath, generating a lot of invalid bugs.
|
||||
|
||||
YUI Compressor 2.3.5, 2008-02-08
|
||||
--------------------------------
|
||||
|
||||
+ Added a warning when more than one 'var' statement is used in a single scope.
|
||||
Automatic coalescence is extremely complicated, and would be unsafe if not
|
||||
done properly.
|
||||
|
||||
YUI Compressor 2.3.4, 2008-02-07
|
||||
--------------------------------
|
||||
|
||||
+ Expanded the list of reserved words used by isValidIdentifier()
|
||||
|
||||
YUI Compressor 2.3.3, 2008-02-04
|
||||
--------------------------------
|
||||
|
||||
+ C-style comments starting with /*! are preserved. This is especially
|
||||
useful with comments containing copyright/license information.
|
||||
|
||||
YUI Compressor 2.3.2, 2008-02-01
|
||||
--------------------------------
|
||||
|
||||
+ Compressing an empty JS file throws an error [SourceForge bug #1884207]
|
||||
+ When a string is the first token in a function body, it was removed from
|
||||
the compressed file [SourceForge bug #1884314]
|
||||
|
||||
YUI Compressor 2.3.1, 2008-01-30
|
||||
--------------------------------
|
||||
|
||||
+ Added test against list of reserved words in method isValidIdentifier.
|
||||
|
||||
YUI Compressor 2.3, 2008-01-28
|
||||
------------------------------
|
||||
|
||||
+ Always output a ';' at the end of a minified JavaScript file. This allows
|
||||
the concatenating of several minified files without the fear of introducing
|
||||
a syntax error.
|
||||
+ Removed all System.exit() statements. Throw exceptions instead. This is
|
||||
especially useful when running the compressor from within a J2EE container.
|
||||
[SourceForge bug #1834750]
|
||||
+ Transform obj["foo"] into obj.foo whenever possible, saving 3 bytes.
|
||||
+ Transform 'foo': ... into foo: ... whenever possible, saving 2 bytes.
|
||||
+ Added support for multi-line string literals [SourceForge bug #1871453]
|
||||
+ Added support for unescaped slashes inside character classes in regexp.
|
||||
+ Minor performance improvements.
|
||||
+ Preserve the escaping for an octal representation of a character in string
|
||||
literals [SourceForge bug #1844894]
|
||||
|
||||
var a = '\001';
|
||||
|
||||
+ CSS: Preserve comments that hide CSS rules from IE Mac:
|
||||
|
||||
/* Hides from IE-mac \*/
|
||||
...
|
||||
/* End hide from IE-mac */
|
||||
|
||||
+ CSS: Added support for box model hack [SourceForge bug #1862107]
|
||||
|
||||
div.content {
|
||||
width:400px;
|
||||
voice-family: "\"}\"";
|
||||
voice-family:inherit;
|
||||
width:300px;
|
||||
}
|
||||
|
||||
YUI Compressor 2.2.5, 2007-10-09
|
||||
--------------------------------
|
||||
|
||||
+ Remove line terminator after escape in string literals.
|
||||
|
||||
YUI Compressor 2.2.4, 2007-10-01
|
||||
--------------------------------
|
||||
|
||||
+ Fixed the way quote characters are counted in string literals
|
||||
[SourceForge bug #1804576]
|
||||
+ Do not use a regular expression using non-greedy matching to remove CSS
|
||||
comments (if the comment is more than 800 characters long or so, a stack
|
||||
overflow exception gets thrown) Instead, use good old parsing...
|
||||
+ Fix unnecessary quote escaping in string literals.
|
||||
|
||||
YUI Compressor 2.2.3, 2007-09-28
|
||||
--------------------------------
|
||||
|
||||
+ Transform </script into <\/script instead of replacing all </ into <\/.
|
||||
+ Fixed bug related to the shortening of hexadecimal color codes (the string
|
||||
"1px solid #aabbcc" became "1px solid#abc", missing a required white space)
|
||||
+ Added --preserve-strings option to specify that concatenated string literals
|
||||
should never be merged.
|
||||
+ Do not convert \uXXXX and \xXX escape sequences to their unicode equivalent.
|
||||
|
||||
YUI Compressor 2.2.2, 2007-09-27
|
||||
--------------------------------
|
||||
|
||||
+ Fixed regression related to the optimization of the amount of escaping
|
||||
in string literals and the concatenation of string literals.
|
||||
+ Modified the Rhino tokenizer to handle JScript conditional comments
|
||||
natively (instead of hacking around the fact that Rhino is not keeping
|
||||
track of comments)
|
||||
+ Transform </ into <\/ in string literals. This is especially useful if the
|
||||
code is written to a script block in an HTML document. This renders the old
|
||||
hack '<scr'+'ipt ...><'+'/script>' completely useless.
|
||||
+ When converting decimal rgb color values to hexadecimal color values,
|
||||
prepend a '0' if the value is less than 16. Otherwise, rgb(0,124,114)
|
||||
for instance becomes #07c72, which is incorrect.
|
||||
+ In CSS files, do not change color names into their corresponding color
|
||||
codes (and vice-versa) due to the high potential of introducing bugs
|
||||
(rolled back from 2.2.1)
|
||||
|
||||
YUI Compressor 2.2.1, 2007-09-25
|
||||
--------------------------------
|
||||
|
||||
+ Optimize quote escaping in JavaScript string literals by using the best quote
|
||||
character (' or " depending on the occurrence of this character in the string)
|
||||
+ Fixed minor bug in the CSS compressor. Colors should not be shortened in
|
||||
filter: chroma(color="#FFFFFF");
|
||||
Otherwise, it makes the filter break in Internet Explorer.
|
||||
+ In CSS files, change color names into their corresponding color codes
|
||||
(and vice-versa) if that change yields any savings.
|
||||
|
||||
YUI Compressor 2.2, 2007-09-18
|
||||
------------------------------
|
||||
|
||||
+ Don't obfuscate function argument named $super if it is the first function
|
||||
argument listed. This is to support Prototype 1.6's heretic implementation.
|
||||
+ Added support for stdin/stdout (see README for more info)
|
||||
+ Shorten colors from rgb(51,102,153) to #336699 in CSS files.
|
||||
+ Shorten values from 0.8em to .8em in CSS files.
|
||||
+ Added support for Internet Explorer's conditional comments in JavaScript
|
||||
files. Note that the presence of a conditional comment inside a function
|
||||
(i.e. not in the global scope) will reduce the level of compression for the
|
||||
same reason the use of 'eval' or 'with' reduces the level of compression
|
||||
(conditional comments, which do not get parsed, may refer to local variables,
|
||||
which get obfuscated) In any case, the use of Internet Explorer's conditional
|
||||
comment is to be avoided.
|
||||
|
||||
YUI Compressor 2.1.2, 2007-08-31
|
||||
--------------------------------
|
||||
|
||||
+ Added --preserve-semi option
|
||||
+ Modified --line-break option
|
||||
|
||||
YUI Compressor 2.1.1, 2007-08-30
|
||||
--------------------------------
|
||||
|
||||
+ Fixed missing space in CSS background:url('foo.png')no-repeat
|
||||
causing a background not to appear on Internet Explorer.
|
||||
|
||||
YUI Compressor 2.1, 2007-08-29
|
||||
------------------------------
|
||||
|
||||
+ Pass the --line-break option to the CSS compressor.
|
||||
+ Allow the output file to overwrite the input file (with version 2.0,
|
||||
in this case, the output file was always empty)
|
||||
+ Remove spaces before and after '(' and ')' as in background:url('xxx');
|
||||
+ Merge (if possible) string literals that are appended in JavaScript files.
|
||||
This not only makes the code smaller, it makes the code faster,
|
||||
but allows you to maintain some readability in your source code.
|
||||
+ Handle constructs such as a + ++ b or a + + "1" (in which case the
|
||||
space between the operators must be kept!) and other similar cases...
|
||||
+ Pass ErrorReporter instance to the constructor of class JavaScriptCompressor
|
||||
(as suggested by David Bernard for his integration of the YUI Compressor
|
||||
as a maven plugin)
|
||||
|
||||
YUI Compressor 2.0, 2007-08-27
|
||||
------------------------------
|
||||
|
||||
+ Switched from Rhino 1.6R6 to Rhino 1.6R7
|
||||
+ Integrated Isaac Schlueter's CSS compressor.
|
||||
+ Refactored code to make it easier to use the compressor from a servlet
|
||||
environment or another Java app (no need to pass in file names anymore)
|
||||
+ Output a white-space character after 'throw' only when necessary.
|
||||
+ Output a white-space character after 'break' and 'continue' when followed
|
||||
by a label.
|
||||
|
||||
YUI Compressor 1.1, 2007-08-20
|
||||
------------------------------
|
||||
|
||||
+ Java source now in package com.yahoo.platform.yui.compressor
|
||||
+ Added --line-break option that adds a line feed character after each
|
||||
semi-colon character (may help debugging with the MS Script debugger)
|
||||
+ Added support for missing JavaScript features (get, set, const)
|
||||
+ Do not show the entire stack trace when the input file cannot be found.
|
||||
+ Removed the randomization of obfuscated symbols. When compressed code is
|
||||
checked in CVS, unchanged files would otherwise end up being versioned.
|
||||
+ Added web-based front-end to the YUI Compressor as part of the dist package.
|
||||
+ Added a public entry point that makes the YUI Compressor easy to integrate
|
||||
with an already existing Java application.
|
||||
+ Simplified code by using the same parsing routines used to build the symbol
|
||||
tree while looking for undeclared symbols.
|
||||
+ Count how many times each identifier is used, and display a warning when an
|
||||
identifier seems to be unused (code cannot safely be removed automatically)
|
||||
+ Remove ';' when followed by a '}'. This yields an additional ~1.5% savings
|
||||
on yahoo-dom-event.js compared to the JSMin version.
|
||||
+ Output a white-space character after 'return' and 'case' only when necessary.
|
||||
140
yuicompressor-2.4.2/doc/README
Normal file
140
yuicompressor-2.4.2/doc/README
Normal file
@@ -0,0 +1,140 @@
|
||||
==============================================================================
|
||||
YUI Compressor
|
||||
==============================================================================
|
||||
|
||||
NAME
|
||||
|
||||
YUI Compressor - The Yahoo! JavaScript and CSS Compressor
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
Usage: java -jar yuicompressor-x.y.z.jar [options] [input file]
|
||||
|
||||
Global Options
|
||||
-h, --help Displays this information
|
||||
--type <js|css> Specifies the type of the input file
|
||||
--charset <charset> Read the input file using <charset>
|
||||
--line-break <column> Insert a line break after the specified column number
|
||||
-v, --verbose Display informational messages and warnings
|
||||
-o <file> Place the output into <file>. Defaults to stdout.
|
||||
|
||||
JavaScript Options
|
||||
--nomunge Minify only, do not obfuscate
|
||||
--preserve-semi Preserve all semicolons
|
||||
--disable-optimizations Disable all micro optimizations
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
The YUI Compressor is a JavaScript compressor which, in addition to removing
|
||||
comments and white-spaces, obfuscates local variables using the smallest
|
||||
possible variable name. This obfuscation is safe, even when using constructs
|
||||
such as 'eval' or 'with' (although the compression is not optimal is those
|
||||
cases) Compared to jsmin, the average savings is around 20%.
|
||||
|
||||
The YUI Compressor is also able to safely compress CSS files. The decision
|
||||
on which compressor is being used is made on the file extension (js or css)
|
||||
|
||||
GLOBAL OPTIONS
|
||||
|
||||
-h, --help
|
||||
Prints help on how to use the YUI Compressor
|
||||
|
||||
--line-break
|
||||
Some source control tools don't like files containing lines longer than,
|
||||
say 8000 characters. The linebreak option is used in that case to split
|
||||
long lines after a specific column. It can also be used to make the code
|
||||
more readable, easier to debug (especially with the MS Script Debugger)
|
||||
Specify 0 to get a line break after each semi-colon in JavaScript, and
|
||||
after each rule in CSS.
|
||||
|
||||
--type js|css
|
||||
The type of compressor (JavaScript or CSS) is chosen based on the
|
||||
extension of the input file name (.js or .css) This option is required
|
||||
if no input file has been specified. Otherwise, this option is only
|
||||
required if the input file extension is neither 'js' nor 'css'.
|
||||
|
||||
--charset character-set
|
||||
If a supported character set is specified, the YUI Compressor will use it
|
||||
to read the input file. Otherwise, it will assume that the platform's
|
||||
default character set is being used. The output file is encoded using
|
||||
the same character set.
|
||||
|
||||
-o outfile
|
||||
Place output in file outfile. If not specified, the YUI Compressor will
|
||||
default to the standard output, which you can redirect to a file.
|
||||
|
||||
-v, --verbose
|
||||
Display informational messages and warnings.
|
||||
|
||||
JAVASCRIPT ONLY OPTIONS
|
||||
|
||||
--nomunge
|
||||
Minify only. Do not obfuscate local symbols.
|
||||
|
||||
--preserve-semi
|
||||
Preserve unnecessary semicolons (such as right before a '}') This option
|
||||
is useful when compressed code has to be run through JSLint (which is the
|
||||
case of YUI for example)
|
||||
|
||||
--disable-optimizations
|
||||
Disable all the built-in micro optimizations.
|
||||
|
||||
NOTES
|
||||
|
||||
+ If no input file is specified, it defaults to stdin.
|
||||
|
||||
+ The YUI Compressor requires Java version >= 1.4.
|
||||
|
||||
+ It is possible to prevent a local variable, nested function or function
|
||||
argument from being obfuscated by using "hints". A hint is a string that
|
||||
is located at the very beginning of a function body like so:
|
||||
|
||||
function fn (arg1, arg2, arg3) {
|
||||
"arg2:nomunge, localVar:nomunge, nestedFn:nomunge";
|
||||
|
||||
...
|
||||
var localVar;
|
||||
...
|
||||
|
||||
function nestedFn () {
|
||||
....
|
||||
}
|
||||
|
||||
...
|
||||
}
|
||||
|
||||
The hint itself disappears from the compressed file.
|
||||
|
||||
+ C-style comments starting with /*! are preserved. This is useful with
|
||||
comments containing copyright/license information. For example:
|
||||
|
||||
/*!
|
||||
* TERMS OF USE - EASING EQUATIONS
|
||||
* Open source under the BSD License.
|
||||
* Copyright 2001 Robert Penner All rights reserved.
|
||||
*/
|
||||
|
||||
becomes:
|
||||
|
||||
/*
|
||||
* TERMS OF USE - EASING EQUATIONS
|
||||
* Open source under the BSD License.
|
||||
* Copyright 2001 Robert Penner All rights reserved.
|
||||
*/
|
||||
|
||||
AUTHOR
|
||||
|
||||
The YUI Compressor was written and is maintained by:
|
||||
Julien Lecomte <jlecomte@yahoo-inc.com>
|
||||
The CSS portion is a port of Isaac Schlueter's cssmin utility.
|
||||
|
||||
COPYRIGHT
|
||||
|
||||
Copyright (c) 2007-2009, Yahoo! Inc. All rights reserved.
|
||||
|
||||
LICENSE
|
||||
|
||||
All code specific to YUI Compressor is issued under a BSD license.
|
||||
YUI Compressor extends and implements code from Mozilla's Rhino project.
|
||||
Rhino is issued under the Mozilla Public License (MPL), and MPL applies
|
||||
to the Rhino source and binaries that are distributed with YUI Compressor.
|
||||
Reference in New Issue
Block a user