DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:ckgedit:compress.sh

This is an old revision of the document!


⇐ 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:

  • any_compr.sh plugin_name.js.unc
    if the script is in /usr/local/bin
  • ./any_compr.sh plugin_name.js.unc
    if the script is in the same directory as the file to be compressed.

The result will be: plugin_name-cmpr.js or 1) The file will have to be renamed plugin_name.js to be used by ckgedit. An optional output file name can be added as a second option to the command, which will produce a file with the optional name: any_compr.sh plugin_name.js.unc file.js.

1)
or css_file-cmpr.css, if you are compressing a style sheet
plugin/ckgedit/compress.sh.1501179717.txt.gz · Last modified: 2017-07-27 20:21 by turnermm

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki