Skip to content

Instantly share code, notes, and snippets.

@allex allex/sass_watch.sh
Last active Aug 29, 2015

Embed
What would you like to do?
#!/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
# ================================================
firstArg="$1"
if [ "$firstArg" != "-s" ]; then
dir=$firstArg
else
shutdown=1
fi
[ -n "$dir" ] || dir=`pwd`
dir=`cd -P -- "$dir" && pwd -P`
pidfile="$dir/.sass.pid"
logfile="$dir/.sass.log"
if [ -f $pidfile ]; then
kill -9 `cat $pidfile` >/dev/null 2>&1
rm -rf $pidfile
fi
[ $shutdown ] && { echo 'shutdown!'; exit 0; }
set -e
if [ ! -f "$dir/config.rb" ]; then
echo "config.rb not found. please run 'compass init' first."
exit 0;
fi
pushd $dir >/dev/null
compass compile "$dir" >$logfile 2>&1&
nohup compass watch >>$logfile 2>&1&
echo $! >$pidfile
echo "compass watch success, pid: $!";
popd >/dev/null
@gnps

This comment has been minimized.

Copy link

commented May 27, 2015

While getting errros, it is getting stop.
Even while errors, I do want to restart / do not stop compiling even If it has errors.
any clues, please...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.