Skip to content

Instantly share code, notes, and snippets.

@art-solopov
Last active October 19, 2018 15:30
Show Gist options
  • Save art-solopov/8fa85f9d6bd5fa0e63ab to your computer and use it in GitHub Desktop.
Save art-solopov/8fa85f9d6bd5fa0e63ab to your computer and use it in GitHub Desktop.
@cli.command()
def app():
from profile_list.app import app
from profile_list.assets import compile_stylus, css_path
import logging
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler, LoggingEventHandler
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
class StylusCompilerHandler(PatternMatchingEventHandler):
def __init__(self):
super().__init__(patterns=['*.styl'])
def on_created(self, _):
compile_stylus()
def on_modified(self, _):
compile_stylus()
observer = Observer()
handler = StylusCompilerHandler()
observer.schedule(handler, css_path, recursive=True)
observer.schedule(LoggingEventHandler(), css_path, recursive=True)
observer.start()
app.run()
observer.stop()
observer.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment