all repos — py-vite @ d8caa0f8c1eecc30bcfdb93e0981645e5e8c2d86

the original vite, written in python

Add pre-build actions

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Tue, 26 May 2020 13:20:15 +0530
commit

d8caa0f8c1eecc30bcfdb93e0981645e5e8c2d86

parent

9f54a8a17314f77726a27e5492d9c905dedd56c0

1 files changed, 9 insertions(+), 0 deletions(-)

jump to
M vite/vite.pyvite/vite.py

@@ -90,6 +90,7 @@ title = ''

author = '' header = '' footer = '' +pre_build = [] post_build = [] template = 'index.html' # default is index.html\n""" )

@@ -252,6 +253,14 @@

def builder(): path = os.getcwd() start = time.process_time() + try: + if config.pre_build != "": + print(run("Running pre-build actions...")) + for s in config.pre_build: + print(info(f"{s}")) + call([s]) + except AttributeError: + pass if not os.listdir(os.path.join(path, PAGES_PATH)): print(info(italic("pages") + " directory is empty. Nothing to build.")) sys.exit(1)