From a4cecd2d0c719beab52fa86b2bc5b7a9ddaa1659 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Thu, 20 Jun 2019 08:30:04 +0200 Subject: [PATCH] Add theme templates, CSS, JS to Invoke livereload task --- pelican/tools/templates/tasks.py.jinja2 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pelican/tools/templates/tasks.py.jinja2 b/pelican/tools/templates/tasks.py.jinja2 index 45c8768d..a800b79b 100644 --- a/pelican/tools/templates/tasks.py.jinja2 +++ b/pelican/tools/templates/tasks.py.jinja2 @@ -102,6 +102,13 @@ def livereload(c): for extension in content_file_extensions: content_blob = '{0}/**/*{1}'.format(SETTINGS['PATH'], extension) server.watch(content_blob, lambda: build(c)) + # 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'])