Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Adam Norwood adamnorwood

👋
View GitHub Profile
@adamnorwood
adamnorwood / Gruntfile.js
Last active Aug 29, 2015
Gruntfile for Pattern Lab + Compass + LiveReload
View Gruntfile.js
/*
Gruntfile for Pattern Lab + Compass + LiveReload
This is a sample Gruntfile for integrating Pattern Lab's template
regeneration with Compass and LiveReload.
I've found that using the Chrome LiveReload extension is slow as it
forces a full-page browser reload instead of using CSS injection. This
Gruntfile setup seems to work great, though, if you use the LiveReload
JS snippet instead. Just add this script right before the closing
@adamnorwood
adamnorwood / Gruntfile.js
Last active Oct 3, 2018
Gruntfile for Pattern Lab + Compass + Live Reload via grunt-browser-sync
View Gruntfile.js
/*
Gruntfile for Pattern Lab + Compass + Live Reload via grunt-browser-sync
Set up to use browser-sync because for the life of me I can't get
the grunt-contrib-watch livereload to *inject* the compiled CSS changes
to the browser (as opposed to livereload doing a full page refresh)...
(To be clear, the CSS injection I'm talking about is where changes to
the CSS file are slipped in to the browser very quickly with no
full page reload, and without losing your place if you've scrolled
@adamnorwood
adamnorwood / newsite.sh
Created May 9, 2013
A simple bash script for setting up a local directory and corresponding entry in /etc/hosts, suitable for use with Apache wildcard name-based virtual hosts. For example: 'newsite example.dev' creates a directory called /www/example.dev/ and also adds appropriate 127.0.0.1 / ::1 entries for example.dev to /etc/hosts (the latter step requires sudo).
View newsite.sh
#!/bin/bash
DIRECTORY="/www/$1"
DIR_CREATED=false
HOSTS_EDITED=false
if [ -d "$DIRECTORY" ]; then
echo "* Directory $DIRECTORY already exists, skipping this step."
else
mkdir $DIRECTORY
DIR_CREATED=true