Fix observer' screen
This commit is contained in:
parent
d29570739b
commit
98912ac09b
11
franca.py
11
franca.py
|
@ -4,7 +4,7 @@ import shutil
|
|||
from pathlib import Path
|
||||
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
from watchdog.events import PatternMatchingEventHandler
|
||||
from jinja2 import Environment, FileSystemLoader, select_autoescape
|
||||
import yaml
|
||||
import frontmatter
|
||||
|
@ -38,7 +38,11 @@ running = False # нужно для проверки
|
|||
# класс для watchdog
|
||||
# Во время разработки, при обнаружении изменений в папках content и themes/{config['theme']},
|
||||
# перегенерировать папку public
|
||||
class Develop(FileSystemEventHandler):
|
||||
class Develop(PatternMatchingEventHandler):
|
||||
def __init__(self):
|
||||
PatternMatchingEventHandler.__init__(self, patterns=['*.md', '*.css'],
|
||||
ignore_directories=True, case_sensitive=False)
|
||||
|
||||
def on_modified(self, event):
|
||||
print(f'event type: {event.event_type} path : {event.src_path}')
|
||||
franca()
|
||||
|
@ -185,7 +189,8 @@ def franca(prod=False):
|
|||
robots_content += "\nDisallow: /"
|
||||
write_file('public/robots.txt', robots_content)
|
||||
|
||||
if prod:
|
||||
global running
|
||||
if not running:
|
||||
if 'pagefind' in config:
|
||||
os.system("npx pagefind --source public") # build search index
|
||||
|
||||
|
|
Loading…
Reference in New Issue