Skip to content

Instantly share code, notes, and snippets.

@lewismcarey
Created May 15, 2015 12:20
Show Gist options
  • Save lewismcarey/d5c9d1c96b7ee8fdf7b4 to your computer and use it in GitHub Desktop.
Save lewismcarey/d5c9d1c96b7ee8fdf7b4 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Some SASS helpers
#
# INSTALL:
#
# * save the sassbash file somewhere
# * chmod +x it to make it executable
# * add path to script in your .bashrc
# * . /path/to/sassbash
#
# USAGE:
#
# Functions run from root directory in a concrete5 site
#
# * sassdev {filename}
# * sasswatch {output-style}
# * sassbuild {output-style}
#
# SASSDEV
#
# Watch specified root scss file expanded with debug info
# Accepts filename parameter [main, old-ie]
#
# `sassdev main`
# `sassdev old-ie`
function sassdev {
THEME="$(ls -d public_html/themes/*)";
sass --watch $THEME/assets/css/SASS/$1.scss:$THEME/assets/css/$1.css --style expanded --debug-info;
}
# SASSWATCH
#
# Watch all SASS root scss files and compile
# Accepts SASS ouput style parameter [nested, expanded, *compact, compressed]
#
# `sasswatch`
# `sasswatch expanded`
function sasswatch {
var="";
THEME="$(ls -d public_html/themes/*)";
for filename in public_html/themes/*/assets/css/SASS/*.scss; do
var=$var" "$filename:$THEME/assets/css/$(basename "$filename" .scss).css;
done
sass --watch $var --style ${1-compact};
}
# SASSBUILD
#
# Process all SASS root scss files and compile
# Accepts SASS ouput style parameter [nested, expanded, compact, *compressed]
#
# `sassbuild`
# `sassbuild compact`
function sassbuild {
THEME="$(ls -d public_html/themes/*)";
for filename in public_html/themes/*/assets/css/SASS/*.scss; do
sass $filename:$THEME/assets/css/$(basename "$filename" .scss).css --style ${1-compressed};
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment