Merge pull request #2584 from justinmayer/reload

Enhance Invoke livereload task
This commit is contained in:
Justin Mayer 2019-06-24 14:13:17 +02:00 committed by GitHub
commit 9154d8f42e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -95,13 +95,22 @@ def livereload(c):
from livereload import Server
build(c)
server = Server()
deploy_path = CONFIG['deploy_path']
content_path = SETTINGS['PATH']
# Watch the base settings file
server.watch(CONFIG['settings_base'], lambda: build(c))
# Watch content source files
content_file_extensions = ['.md', '.rst']
for file_extension in content_file_extensions:
content_blob = '{0}/**/*{1}'.format(content_path, file_extension)
for extension in content_file_extensions:
content_blob = '{0}/**/*{1}'.format(SETTINGS['PATH'], extension)
server.watch(content_blob, lambda: build(c))
server.serve(root=deploy_path)
# Watch the theme's templates and static assets
theme_path = SETTINGS['THEME']
server.watch('{}/templates/*.html'.format(theme_path), lambda: build(c))
static_file_extensions = ['.css', '.js']
for extension in static_file_extensions:
static_file = '{0}/static/**/*{1}'.format(theme_path, extension)
server.watch(static_file, lambda: build(c))
# Serve output path on configured port
server.serve(port=CONFIG['port'], root=CONFIG['deploy_path'])
{% if cloudfiles %}
@task