Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 22 lines (16 sloc) 561 Bytes
#!/usr/bin/env python
import pyinotify
import os
wm = pyinotify.WatchManager() # Watch Manager
mask = pyinotify.IN_CREATE # watched events
cmd = "lessc -x hicap/static/main.less > hicap/static/css/main.css"
class EventHandler(pyinotify.ProcessEvent):
def process_IN_CREATE(self, event):
if event.name.endswith('.less'):
os.system('date')
print "Creating:", event.pathname
os.system(cmd)
handler = EventHandler()
notifier = pyinotify.Notifier(wm, handler)
wdd = wm.add_watch('hicap/static/less/', mask, rec=True)
notifier.loop()