Implement watching static files

This commit is contained in:
Bálint Bokros
2017-12-11 13:34:08 +01:00
parent c1f867f97c
commit 642ca7f54c
2 changed files with 22 additions and 0 deletions

19
lib/debug.py Normal file
View File

@ -0,0 +1,19 @@
from glob import iglob as glob
from itertools import chain
from tornado.autoreload import watch
# yo dawg, we heard you like generators, so now you can generate generators
# with generators
def _static_files():
return chain.from_iterable(
glob(pattern) for pattern in (
'static/*.js', 'static/*.css', 'templates/*htm?'
)
)
def watch_static_files():
for file in _static_files():
watch(file)