Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self.should_handle(event_type, src_path):
print("%s %s" % (event_type, filename))
if self.site.is_static(filename):
files = self.site.get_dependencies(filename)
self.site.copy_static(files)
# js/css变化时, 强制重新渲染
self.site.render_templates(self.site.templates)
elif data_pattern.match(filename):
# 数据文件变动时, 重新渲染
self.site.render_templates(self.site.templates)
else:
templates = self.site.get_dependencies(filename)
self.site.render_templates(templates)
Reloader.event_handler = event_handler
PROJECT_ROOT_DIR = dirname(dirname(realpath(dirname(__file__))))
SITE_SRC_DIR = join(PROJECT_ROOT_DIR, 'src')
SITE_ASSET_SRC_DIR = join(PROJECT_ROOT_DIR, 'asset')
DATA_SRC_DIR = join(SITE_SRC_DIR, "data")
SITE_ASSET_URL_PREFIX = './asset'
# 不能使用默认的 Cache 目录, 否则 Cache 也会被 staticjinja 拷贝
WEBASSETS_CACHE_DIR = join(PROJECT_ROOT_DIR, '.webassets-cache')
# 静态站点输出根目录
SITE_DIR = join(PROJECT_ROOT_DIR, 'public')
# webassets 输出根目录, 要输出到 SITE_SRC_DIR, 以便 staticjinja 监控文件变化
SITE_ASSET_DIR = join(SITE_SRC_DIR, 'asset')