本文共 1522 字,大约阅读时间需要 5 分钟。
#!/bin/bashcd /usr/local/src/wget https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jarmv yuicompressor-2.4.8.jar /usr/local/libexec/cat >> /usr/local/bin/yuicompressor <<'EOF'java -jar /usr/local/libexec/yuicompressor-2.4.8.jar $@EOFchmod +x /usr/local/bin/yuicompressor
$ yuicompressorYUICompressor Version: 2.4.8Usage: java -jar yuicompressor-2.4.8.jar [options] [input file]Global Options -V, --version Print version information -h, --help Displays this information --type原文出处:Netkiller 系列 手札 本文作者:陈景峯 转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。Specifies the type of the input file --charset Read the input file using --line-break Insert a line break after the specified column number -v, --verbose Display informational messages and warnings -o Place the output into . Defaults to stdout. Multiple files can be processed using the following syntax: java -jar yuicompressor.jar -o '.css$:-min.css' *.css java -jar yuicompressor.jar -o '.js$:-min.js' *.jsJavaScript Options --nomunge Minify only, do not obfuscate --preserve-semi Preserve all semicolons --disable-optimizations Disable all micro optimizationsIf no input file is specified, it defaults to stdin. In this case, the 'type'option is required. Otherwise, the 'type' option is required only if the inputfile extension is neither 'js' nor 'css'.