#!/bin/sh
# Safe CSS minifier that:
#   * Filters from stdin to stout.
#   * Removes excess whitespace (including newlines) and comments.
#   * Merges adjacent blocks for identical selectors if possible.
#   * Does not strip out fallback support for older browsers.
#
# Falls back to identity transformation if the tool is unavailable.
#
# On V4.1.9 as of 2017/11/26.

# Ensure that /usr/local/bin is on the PATH for 'node' at al.
. script/NPM.loc
PATH="$PATH:$NPMBIN"
export PATH

# Expected location of cleancss
CLEANCSS=$NPMBIN/cleancss

if [ ! -x $CLEANCSS ]; then exec cat; exit 0; fi

# Command to be run.
exec $CLEANCSS -O1 all:on -O2 'overrideProperties:off'

# The following level-2 optimisations have to be adjusted for cleancss 4.1.9
# to avoid stripping out fallbacks for older browsers:
#     overrideProperties:off
