#!/bin/bash

set -e

files=`ls templates/lib/*.js style/*.css`
for file in $files; do
	# skip dropmenu file, incompatible with YUI compressor
	if [[ $file =~ .*dropmenu.* ]]; then
		continue
	fi
	yui-compressor --nomunge --preserve-semi --disable-optimizations --charset UTF-8 -o ${file}-MIN $file
	rm $file
	mv ${file}-MIN $file
	# add final new line to supress Debian warnings
	echo "" >> $file
done