Skip to content

Instantly share code, notes, and snippets.

@liamcurry
Created September 18, 2011 19:53
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 liamcurry/1225481 to your computer and use it in GitHub Desktop.
Save liamcurry/1225481 to your computer and use it in GitHub Desktop.
Start coffee, compass, and a simple HTTP server with one script
#!/usr/bin/python
import os
import subprocess
import signal
import sys
STATICGEN_ROOT = (os.path.join(os.path.dirname(
os.path.dirname(os.path.abspath(__file__))),
'staticgen'))
staticgen_path = lambda *a: os.path.abspath(os.path.join(STATICGEN_ROOT, *a))
# Compiles all Compass files and throws them in `static/css`
compass_location = staticgen_path('compass')
compass_args = [
'compass',
'watch',
compass_location
]
# Compiles all Coffeescript files and throws them in `static/js`
coffee_location = staticgen_path('coffee')
coffee_location_output = staticgen_path('..', 'static', 'js')
coffee_args = [
'coffee',
'--watch',
'--output',
coffee_location_output,
'--compile',
coffee_location
]
compass_process = subprocess.Popen(compass_args)
coffee_process = subprocess.Popen(coffee_args)
def signal_handler(signal, frame):
compass_process.terminate()
coffee_process.terminate()
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
signal.pause()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment