DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:ckgedit:compress.sh

⇐ ckgedit Plugin Page

any_compr.sh
#!/bin/sh
IN=$1
 
if [ "$2" ]
then
OUT=$2
EXTENSION=` echo $1 | awk -F. '{ print $2 }' `
else
BASENAME=` echo $1 |  awk -F. '{ print $1 }' `
EXTENSION=` echo $1 | awk -F. '{ print $2 }' `
echo $BASENAME
OUT="$BASENAME-cmpr.$EXTENSION"
fi
echo $OUT
YUI=/usr/lib/jvm/yui/yuicompressor
java  -jar $YUI --type $EXTENSION $IN -o $OUT

This script will compress both .js and .css files. The script picks up the type of file to be compressed from the file's extension. YUI will have to be changed to wherever the yuicompressor has been stored.

Usage:

  1. any_compr.sh plugin_name.js.unc
    if the script is in /usr/local/bin
  2. ./any_compr.sh plugin_name.js.unc
    if the script is in the same directory as the file to be compressed.
  3. any_compr.sh plugin_name.js.unc file.js
    an optional output file name can be added as a second option.

The first two forms will produce a file named plugin_name-cmpr.js. The third form will produce a file named file.js.

plugin/ckgedit/compress.sh.txt · Last modified: 2017-07-27 20:29 by turnermm