Skip to content

Instantly share code, notes, and snippets.

@lyrixx
Last active August 29, 2015 13:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyrixx/9119289 to your computer and use it in GitHub Desktop.
Save lyrixx/9119289 to your computer and use it in GitHub Desktop.
Refresh assetic on any modification
#!/bin/bash
BASE_PATH=`dirname $0`/..
ASSETS_PATH=$BASE_PATH/app/Resources/assets
ASSETS_PATH2=$BASE_PATH/src/SensioLabs/Bundle/InsightAnalysisBundle/Resources/public
if [[ `which inotifywait` ]]; then
while true; do
inotifywait -r -e modify -e move -e create -e delete $ASSETS_PATH/ $ASSETS_PATH2/ | while read line; do
php $BASE_PATH/app/console assetic:dump --force
done
done
elif [[ `which fswatch` ]]; then
fswatch -L -r -e '.*\/\..*' $ASSETS_PATH $ASSETS_PATH2 | while read line; do
php $BASE_PATH/app/console assetic:dump --force
done
else
NOCOLOR='\e[0m'
REDCOLOR='\e[37;41m'
echo -e "$REDCOLOR You must install one of 'inotifywait' or 'fswatch'.$NOCOLOR"
echo ""
echo ' # apt-get install inotify-tools'
echo ' # brew install fswatch'
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment