Skip to content

Instantly share code, notes, and snippets.

@EdaCZ
Last active November 8, 2017 00:48
Show Gist options
  • Save EdaCZ/10171115 to your computer and use it in GitHub Desktop.
Save EdaCZ/10171115 to your computer and use it in GitHub Desktop.
# zkompilovani scss souboru pri komitu
# ve zmenenych souborech komitu hledej .scss
git diff --cached --name-only | grep '\.scss$' | while IFS= read -r line;
do
# jen pokud soubor existuje
if [ -f ${line} ]; then
# zkompilovani na CSS
echo " kompilace SCSS: " ${line};
scss --update --force --sourcemap=none --no-cache ${line};
# nahrazeni pripony SCSS za CSS
outfile=$(echo ${line} | sed 's/\.scss$/\.css/g')
# pridani zkompilovaneho CSS do komitu
git add ${outfile}
fi
done
# testy s Nette Testerem
git stash -q --keep-index
tester
RESULT=$?
git stash pop -q
[ $RESULT -ne 0 ] && exit 1
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment