Add post-build actions Signed-off-by: Anirudh <icyph0x@pm.me>
Anirudh icyph0x@pm.me
Fri, 09 Aug 2019 11:02:44 +0530
2 files changed,
13 insertions(+),
1 deletions(-)
M
README.md
→
README.md
@@ -45,6 +45,7 @@ author = ''
header = '' footer = '' template = 'index.html' # default is templates/index.html +post_build = [] # list of commands to run post-build ``` Templating@@ -73,7 +74,7 @@ ---
template: foo.html title: Some fancy buzzwords here subtitle: Cool catch phrase here -date: 1 April, 2019 +date: 2019-08-09 --- ## markdown here
M
vite/vite.py
→
vite/vite.py
@@ -17,6 +17,7 @@
from markdown2 import markdown_path from huepy import * from livereload import Server +from subprocess import call # constants@@ -87,6 +88,7 @@ title = ''
author = '' header = '' footer = '' +post_build = [] template = 'index.html' # default is index.html\n""")@@ -230,3 +232,12 @@ html_gen()
if os.path.exists(os.path.join(os.getcwd(), 'static')): shutil.copytree(os.path.join(os.getcwd(), 'static'), os.path.join(BUILD_PATH, 'static')) print(good('Done in %0.5fs.' % (time.process_time() - start))) + try: + if config.post_build != '': + print(run('Running post-build actions...')) + for s in config.post_build: + print(info(f'{s}')) + call([s]) + except AttributeError: + pass +