Created
September 18, 2011 19:53
-
-
Save liamcurry/1225481 to your computer and use it in GitHub Desktop.
Start coffee, compass, and a simple HTTP server with one script
This file contains 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
#!/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