Permalink
Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (25 sloc) 857 Bytes
#!/bin/bash
# @sass: minify scss file(s).
# Pre-Pathing: allow 'sass' command
PATH="/usr/local/bin:$PATH"
# track execution of script
log_file=/vagrant/log/webcompiler/sass.log
set -x;
exec &> >(while read -r line; do
log_date=$(date +%Y-%m-%d:%H:%M:%S)
printf "%s %s\n" "[$log_date]" "$line" >> "$log_file"
done)
# watch '/vagrant/src/scss/' subdirectory
inotifywait /vagrant/src/scss/ -m -e close_write -e move --format %f |
# Compile CSS
while read -r file; do
# get last `.` occurence as starting extension
extension=${file##*.}
# filename (without 'last' extension)
filename="${file%.*}"
if [ "$extension" = 'scss' ] && [ "${file:0:1}" != '_' ]
then
# compile with 'scss'
node-sass /vagrant/src/scss/"$file" /vagrant/interface/static/css/"$filename".min.css --output-style compressed
fi
done