Created
July 10, 2013 14:23
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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