Skip to content

Instantly share code, notes, and snippets.

@dre1080
Created April 27, 2012 04:57
Show Gist options
  • Save dre1080/2505985 to your computer and use it in GitHub Desktop.
Save dre1080/2505985 to your computer and use it in GitHub Desktop.
Compile and watch Sass (using Compass) and CoffeeScript files with one command
#!/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