Created
April 27, 2012 04:57
-
-
Save dre1080/2505985 to your computer and use it in GitHub Desktop.
Compile and watch Sass (using Compass) and CoffeeScript files with one command
This file contains 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 | |
type -P compass &>/dev/null || { echo "Compass command not found."; exit 1; } | |
type -P coffee &>/dev/null || { echo "Coffee command not found."; exit 1; } | |
# Get current directory (project path) | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
SASS_DIR="$DIR/public/stylesheets/sass/" | |
CSS_DIR="$DIR/public/stylesheets/" | |
CS_DIR="$DIR/public/coffeescripts/" | |
JS_DIR="$DIR/public/javascripts/" | |
if [ ! -d "$SASS_DIR" ] || [ ! -d "$CS_DIR" ] | |
then | |
echo "Project not setup correctly! Put sass files in "$SASS_DIR" and coffee in "$CS_DIR"" | |
else | |
if [ ! -d "$CSS_DIR" ] | |
then | |
mkdir "$CSS_DIR" | |
fi | |
if [ ! -d "$JS_DIR" ] | |
then | |
mkdir "$JS_DIR" | |
fi | |
echo "Watching changes in "$SASS_DIR" and "$CS_DIR" and compiling to "$CSS_DIR" and "$JS_DIR" respectively..." | |
`compass watch "$DIR"` & | |
`coffee -o "$JS_DIR" -cwl "$CS_DIR"` & | |
wait | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment