README 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. ==============================================================================
  2. YUI Compressor
  3. ==============================================================================
  4. NAME
  5. YUI Compressor - The Yahoo! JavaScript and CSS Compressor
  6. SYNOPSIS
  7. Usage: java -jar yuicompressor-x.y.z.jar [options] [input file]
  8. Global Options
  9. -h, --help Displays this information
  10. --type <js|css> Specifies the type of the input file
  11. --charset <charset> Read the input file using <charset>
  12. --line-break <column> Insert a line break after the specified column number
  13. -v, --verbose Display informational messages and warnings
  14. -o <file> Place the output into <file>. Defaults to stdout.
  15. JavaScript Options
  16. --nomunge Minify only, do not obfuscate
  17. --preserve-semi Preserve all semicolons
  18. --disable-optimizations Disable all micro optimizations
  19. DESCRIPTION
  20. The YUI Compressor is a JavaScript compressor which, in addition to removing
  21. comments and white-spaces, obfuscates local variables using the smallest
  22. possible variable name. This obfuscation is safe, even when using constructs
  23. such as 'eval' or 'with' (although the compression is not optimal is those
  24. cases) Compared to jsmin, the average savings is around 20%.
  25. The YUI Compressor is also able to safely compress CSS files. The decision
  26. on which compressor is being used is made on the file extension (js or css)
  27. GLOBAL OPTIONS
  28. -h, --help
  29. Prints help on how to use the YUI Compressor
  30. --line-break
  31. Some source control tools don't like files containing lines longer than,
  32. say 8000 characters. The linebreak option is used in that case to split
  33. long lines after a specific column. It can also be used to make the code
  34. more readable, easier to debug (especially with the MS Script Debugger)
  35. Specify 0 to get a line break after each semi-colon in JavaScript, and
  36. after each rule in CSS.
  37. --type js|css
  38. The type of compressor (JavaScript or CSS) is chosen based on the
  39. extension of the input file name (.js or .css) This option is required
  40. if no input file has been specified. Otherwise, this option is only
  41. required if the input file extension is neither 'js' nor 'css'.
  42. --charset character-set
  43. If a supported character set is specified, the YUI Compressor will use it
  44. to read the input file. Otherwise, it will assume that the platform's
  45. default character set is being used. The output file is encoded using
  46. the same character set.
  47. -o outfile
  48. Place output in file outfile. If not specified, the YUI Compressor will
  49. default to the standard output, which you can redirect to a file.
  50. -v, --verbose
  51. Display informational messages and warnings.
  52. JAVASCRIPT ONLY OPTIONS
  53. --nomunge
  54. Minify only. Do not obfuscate local symbols.
  55. --preserve-semi
  56. Preserve unnecessary semicolons (such as right before a '}') This option
  57. is useful when compressed code has to be run through JSLint (which is the
  58. case of YUI for example)
  59. --disable-optimizations
  60. Disable all the built-in micro optimizations.
  61. NOTES
  62. + If no input file is specified, it defaults to stdin.
  63. + The YUI Compressor requires Java version >= 1.4.
  64. + It is possible to prevent a local variable, nested function or function
  65. argument from being obfuscated by using "hints". A hint is a string that
  66. is located at the very beginning of a function body like so:
  67. function fn (arg1, arg2, arg3) {
  68. "arg2:nomunge, localVar:nomunge, nestedFn:nomunge";
  69. ...
  70. var localVar;
  71. ...
  72. function nestedFn () {
  73. ....
  74. }
  75. ...
  76. }
  77. The hint itself disappears from the compressed file.
  78. + C-style comments starting with /*! are preserved. This is useful with
  79. comments containing copyright/license information. For example:
  80. /*!
  81. * TERMS OF USE - EASING EQUATIONS
  82. * Open source under the BSD License.
  83. * Copyright 2001 Robert Penner All rights reserved.
  84. */
  85. becomes:
  86. /*
  87. * TERMS OF USE - EASING EQUATIONS
  88. * Open source under the BSD License.
  89. * Copyright 2001 Robert Penner All rights reserved.
  90. */
  91. AUTHOR
  92. The YUI Compressor was written and is maintained by:
  93. Julien Lecomte <jlecomte@yahoo-inc.com>
  94. The CSS portion is a port of Isaac Schlueter's cssmin utility.
  95. COPYRIGHT
  96. Copyright (c) 2007-2009, Yahoo! Inc. All rights reserved.
  97. LICENSE
  98. All code specific to YUI Compressor is issued under a BSD license.
  99. YUI Compressor extends and implements code from Mozilla's Rhino project.
  100. Rhino is issued under the Mozilla Public License (MPL), and MPL applies
  101. to the Rhino source and binaries that are distributed with YUI Compressor.