#!/bin/sh

########################################################################
#
#  Copyright 2002, Tero Tilus <tero@tilus.net>
#
#  This software is distributed under the terms of the GNU general
#  Public license <http://www.gnu.org/licenses/gpl.html> and WITHOUT
#  ANY WARRANTY.
#
########################################################################

# Combine all css files in current directory into single css file
# 'combined-css.txt'.  Backup original css files with extension bak
# and replace them with symbolic links to newly created combined css.

# Function to backup file and replace it with a symlink
function mvln() {
	mv $2 $2.bak
	ln -s $1 $2
}

# Filename for combined css, must not be *css!
COMBINEFILE=combined-css.txt

# Combine existing stylesheets to combinefile
combine-css.py *.css > $COMBINEFILE

# Replace css -files with a symlink to combined file
# find -type f -name '*.css' | xargs mvln $COMBINEFILE
for CSSFILE in `find -type f -name '*.css'`;
do
	mvln $COMBINEFILE $CSSFILE;
done;
