all repos — py-vite @ 50d543fa7ab1dca55c7e688a1f5b221fed564520

the original vite, written in python

fix: clean() no longer deletes and recreates BUILD_PATH

This should fix issues with webservers with hot reloading.

Signed-off-by: Anirudh <icyph0x@pm.me>
Anirudh icyph0x@pm.me
Thu, 27 Sep 2018 23:21:49 +0530
commit

50d543fa7ab1dca55c7e688a1f5b221fed564520

parent

751d91258fd4d30a6d120fd4daf385a5157f57d6

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

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

@@ -181,8 +181,17 @@ sys.exit(1)

def clean(): - shutil.rmtree(BUILD_PATH) - os.makedirs(BUILD_PATH) + #shutil.rmtree(BUILD_PATH) + #os.makedirs(BUILD_PATH) + for f in os.listdir(BUILD_PATH): + fpath = os.path.join(BUILD_PATH, f) + try: + if os.path.isfile(fpath): + os.unlink(fpath) + elif os.path.isdir(fpath): + shutil.rmtree(fpath) + except Exception as e: + print(e) def builder():