Skip to content

Instantly share code, notes, and snippets.

@Fluffywuffy
Forked from dre1080/watch.sh
Created August 8, 2017 11:40
Show Gist options
  • Save Fluffywuffy/da2dd0bdc312937289b315c94c9b7c74 to your computer and use it in GitHub Desktop.
Save Fluffywuffy/da2dd0bdc312937289b315c94c9b7c74 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
@Fluffywuffy
Copy link
Author

seems like a great .sh file I can't wait to try it out that's timmy aka fluffywuffy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment