Skip to content

Instantly share code, notes, and snippets.

@rahulsom
Created June 13, 2011 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulsom/1023323 to your computer and use it in GitHub Desktop.
Save rahulsom/1023323 to your computer and use it in GitHub Desktop.
Generate blueprint css anywhere
#!/bin/bash -e
#
# Generates Blueprint files from a blueprint-settings.yml
#
TAG_TO_USE="v1.0.1" # Master is often messy
EXEC_DIR=$(pwd)
echo "Will run in ${EXEC_DIR}"
# Create a working directory for blueprint
if [ ! -d ~/.blueprint ]; then
mkdir -p ~/.blueprint
fi
cd ~/.blueprint
# Check out blueprint or update blueprint
if [ ! -d blueprint-css ]; then
git clone git://github.com/joshuaclayton/blueprint-css.git
cd blueprint-css
git checkout ${TAG_TO_USE}
else
cd blueprint-css
if [ "${TAG_TO_USE}" = "$(git describe --always --tag)" ]; then
echo "In the right tag"
else
git checkout master
git pull
git checkout ${TAG_TO_USE}
fi
fi
# Comeback to directory where this is required
cd ${EXEC_DIR}
if [ ! -e blueprint-settings.yml ]; then
cat > blueprint-settings.yml << EOF
# refer to http://www.yaml.org/spec/1.1/ for clarification on YAML collections
# refer to ${HOME}/.blueprint/blueprint-css/lib/settings.example.yml for blueprint-settings.yml standard
default:
path: web-app/css/default
namespace: p-
plugins:
- fancy-type
- buttons
semantic_classes:
".container": ".container"
".logo": ".span-4"
"#auth": ".span-4 .right .last"
".headersub": ".span-24 .last"
EOF
fi
# Create directories for putting the CSS.
cat blueprint-settings.yml | grep -v "^#" | grep "path:" | tr -s " " | cut -d : -f 2 | xargs mkdir -p
# Run blueprint's compress.rb script for all projects in the settings file
cat blueprint-settings.yml | grep -v "^#" | grep -v "^ " | sed "s/://g" | xargs -n 1 -I {} \
ruby $HOME/.blueprint/blueprint-css/lib/compress.rb -sblueprint-settings.yml -p {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment