Skip to content

Instantly share code, notes, and snippets.

@gnps
Forked from allex/sass_watch.sh
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnps/35f9950ca376fdf15cc6 to your computer and use it in GitHub Desktop.
Save gnps/35f9950ca376fdf15cc6 to your computer and use it in GitHub Desktop.
#!/bin/sh
# ================================================
# Description: Run compass watch in background
# GistID: 965f3e1a0876592db33f
# GistURL https://gist.github.com/allex/965f3e1a0876592db33f
# Author: Allex Wang (allex.wxn@gmail.com)
# Last Modified: Tue Dec 09, 2014 12:12PM
# ================================================
dir="$1"
[ -n "$dir" ] || dir=`pwd`
pidfile="$dir/.sass.pid"
logfile="$dir/.sass.log"
if [ -f $pidfile ]; then
kill -9 `cat $pidfile` >/dev/null 2>&1
rm -rf $pidfile
[ "$1" = "stop" ] && echo 'shutdown!' && exit 0;
fi
set -e
if [ ! -f "$dir/config.rb" ]; then
echo "config.rb not found. please run 'compass init' first."
exit 0;
fi
compass compile "$dir" >$logfile 2>&1&
nohup compass watch --poll "$dir" >>$logfile 2>&1 &
echo $! >$pidfile
echo "compass watch success, pid: $!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment