From 3a9427912bc4e93b10858405a14371a59f64cefc Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 10 Jan 2017 09:09:30 +0000 Subject: [PATCH] Add static build script --- config/config.yml | 1 + plugins/post_build.py | 15 +++++++++++++++ plugins/static_build.py | 11 +++++++++++ 3 files changed, 27 insertions(+) create mode 100644 plugins/post_build.py create mode 100644 plugins/static_build.py diff --git a/config/config.yml b/config/config.yml index 22cdbef..40ff73d 100644 --- a/config/config.yml +++ b/config/config.yml @@ -14,6 +14,7 @@ pelican_plugins: - autopages - screenfetch - post_build + - static_build sitemap_format: xml diff --git a/plugins/post_build.py b/plugins/post_build.py new file mode 100644 index 0000000..cfcd372 --- /dev/null +++ b/plugins/post_build.py @@ -0,0 +1,15 @@ +from pelican import signals +import os + + +OUTPUT_PATH = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'output') + + +def post_build(*args, **kwargs): + os.system("mv {0}/assets/robots.txt {0}".format(OUTPUT_PATH)) + os.system("cp -R {0}/assets/* {0}/static".format(OUTPUT_PATH)) + os.system("rm -rf {0}/assets".format(OUTPUT_PATH)) + + +def register(): + signals.finalized.connect(post_build) diff --git a/plugins/static_build.py b/plugins/static_build.py new file mode 100644 index 0000000..2908bab --- /dev/null +++ b/plugins/static_build.py @@ -0,0 +1,11 @@ +from pelican import signals +import os + + +def static_build(*args, **kwargs): + os.system('npm run build-js') + os.system('npm run build-scss') + + +def register(): + signals.static_generator_init.connect(static_build)