Created
November 3, 2013 05:59
-
-
Save grevory/7287252 to your computer and use it in GitHub Desktop.
A simple script to compile CSS from LESS for a production environment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LESSCSS="First parameter" | |
COMPILEDCSS=$2 | |
if [ -z "$1" -o -z "$2" ]; then | |
echo "To use compile-css pass 1. less file 2. compiled css file" | |
fi | |
if [[ $1 ]]; then | |
LESSCSS=$1 | |
fi | |
# The first parameter needs to be a file and needs to exist | |
if [[ -d $LESSCSS ]]; then | |
echo "$LESSCSS is a directory. Needs to be a file." | |
exit 1 | |
elif [[ -f $LESSCSS ]]; then | |
echo "Compiling $LESSCSS..." | |
else | |
echo "$LESSCSS needs to be a file" | |
exit 1 | |
fi | |
# If the second parameter is already a file we need to remove it | |
if [[ -f $PASSED ]]; then | |
rm $COMPILEDCSS | |
fi | |
lessc $LESSCSS > $COMPILEDCSS --yui-compress | |
echo "$COMPILEDCSS compiled" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment