Skip to content

Instantly share code, notes, and snippets.

@daphotron
Created July 10, 2013 14:23
Show Gist options
  • Select an option

  • Save daphotron/5966722 to your computer and use it in GitHub Desktop.

Select an option

Save daphotron/5966722 to your computer and use it in GitHub Desktop.
Compass compile --force all .scss files inside drupal sites folders. Excludes files asset folder.
#!/bin/bash
# Finds any .scss files inside the /sites directory (excluding /files)
# Creates unique array of paths which contain the .scss files
# Run compass compile --force within the directories
# Script path
SCRIPT_DIR=`pwd`
# Sites path relative to the location of where this script file is kept.
SITES_DIR='../../../path/to/sites/'
# Array of sass filepaths
sassfolders=()
# Enter sites directory
cd $SITES_DIR
# Find all .scss files in /sites directory excluding /files
sassfiles=$(find . -iregex '.*.scss' -type f ! -path './files*')
# Find and generate an array of sass directories
for f in $sassfiles
do
sassfolders+=$(dirname ${f})
sassfolders+=' '
done
# Create unique list of sass directories
dirlist=$(echo $sassfolders | tr ' ' '\n' | sort -u)
# Force compile in each sass directory
for dir in $dirlist
do
echo Running compass compile --force inside: $dir
cd $SCRIPT_DIR
cd $SITES_DIR/$dir
compass compile --force
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment