all repos — py-vite @ 3f57407465a9c5d70a1b34d92262d9ebdd7d8e1c

the original vite, written in python

Add post-build actions

Signed-off-by: Anirudh <icyph0x@pm.me>
Anirudh icyph0x@pm.me
Fri, 09 Aug 2019 11:02:44 +0530
commit

3f57407465a9c5d70a1b34d92262d9ebdd7d8e1c

parent

ec4aac77993136fd673310b17e3b84b2eb93bf9b

2 files changed, 13 insertions(+), 1 deletions(-)

jump to
M README.mdREADME.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.pyvite/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 +