mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #2584 from justinmayer/reload
Enhance Invoke livereload task
This commit is contained in:
commit
9154d8f42e
1 changed files with 14 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue