view scripts/minifier/minify.sh @ 171:a213053a03be

flatpak: update files following names change + Python 3 update: - `build_manifest.py` has been fixed to work with recent SàT/Libervia - filenames/scripts have been udpated to reflect project name change - installation now uses `requirements.txt` when dev version is requested - there are now 3 types of commands wrapper: * `libervia_wrapper.py` uses `pb` bridge, starts backend before frontend, and stops it when frontend is stopped. It's used by `Libervia Desktop` (Cagou) * `libervia_wrapper-dbus.py` uses `dbus` bridge, starts backend before frontend, and stops it when frontend is stopped. It's used for `Libervia TUI` (Primitivus) * `libervia_wrapper-dbus.py` uses `dbus` bridge, starts backend if necessary and doesn't stop it (to avoid waiting for backend start next time). It's used by `Libervia CLI` (jp).
author Goffi <goffi@goffi.org>
date Tue, 30 Nov 2021 21:42:06 +0100
parents 1596660ddf72
children
line wrap: on
line source

#!/bin/bash

# This is a helping script to minify HTML/CSS/JavaScript files

# Minify JS for Libervia's OTR - https://github.com/arlolra/otr
TOOL="yui compressor"
OTR_INPUT="otr/dep/bigint.js otr/dep/crypto.js otr/dep/eventemitter.js"
OTR_APPEND="otr/otr.min.js"
OTR_OUTPUT="otr.min.js"

rm -f $OTR_OUTPUT
if [[ $TOOL = "closure compiler" ]]; then
    # use https://developers.google.com/closure/compiler/
    # requires Java 7 SDK + compiler.jar in the current directory
    echo "Minifying $OTR_INPUT with closure compiler"
    java -jar compiler.jar  --js_output_file=$OTR_OUTPUT $OTR_INPUT
else
    for FILE in $OTR_INPUT; do
        if [[ $TOOL = "slimit" ]]; then
            # use https://pypi.python.org/pypi/slimit
            echo "Minifying $FILE with slimit"
            slimit $FILE >> $OTR_OUTPUT
        elif [[ $TOOL = "yui compressor" ]]; then
            # use https://pypi.python.org/pypi/yuicompressor
            echo "Minifying $FILE with YUI compressor"
            yuicompressor -o tmp.js $FILE
            cat tmp.js >> $OTR_OUTPUT
            rm -f tmp.js
        fi
    done
fi
cat $OTR_APPEND >> $OTR_OUTPUT
echo "The file $OTR_OUTPUT includes:
    - minified versions of the following otr.js dependencies:
      $OTR_INPUT
      The following minification tool has been used: $TOOL
    - minified version of otr.js taken from the project homepage

All original files can be retrieved from otr.js repository:
    https://github.com/arlolra/otr/tree/master/build
" > "$OTR_OUTPUT"_README