Last active
October 19, 2018 15:30
-
-
Save art-solopov/8fa85f9d6bd5fa0e63ab to your computer and use it in GitHub Desktop.
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
@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