feat: minor changes add `build` argument back - can now be executed as `vite build`
Anirudh icyph0x@pm.me
Thu, 19 Apr 2018 19:50:54 +0530
2 files changed,
7 insertions(+),
27 deletions(-)
M
vite/make.py
→
vite/make.py
@@ -87,9 +87,11 @@ sys.exit(1)
def main(): + args = parser().parse_args() + if args.serve: server() - else: + elif args.build: start = time.process_time() TEMPL_FILE = TEMPL_PATH + config.template if not os.listdir(PAGES_PATH):@@ -104,32 +106,10 @@ copy_tree('static', os.path.join(BUILD_PATH, 'static'))
print(good('Done in %0.5fs.' % (time.process_time() - start))) except jinja2.exceptions.TemplateNotFound: print(bad('Error: specified template not found: %s' % TEMPL_FILE)) - - -if __name__ == "__main__": - desc = green('Script to build and serve Vite projects.') - usage = lightblue('make.py') + ' [serve]' - help_txt = 'Serve pages from the ' + italic('build') + ' directory.' - parser = argparse.ArgumentParser(description=desc, usage=usage) - parser.add_argument('serve', nargs='*', help=help_txt) - - args = parser.parse_args() - - # import config file - try: - sys.path.append(os.getcwd()) - import config - except ModuleNotFoundError: - print(bad('Error: config.py not found.')) - print(que('Are you sure you\'re in a project directory?')) - parser.print_help() + else: + parser().print_help() sys.exit(1) - # constants - PAGES_PATH = 'pages/' - BUILD_PATH = 'build/' - TEMPL_PATH = 'templates/' - TEMPL_FILE = TEMPL_PATH + config.template - PORT = 1911 +if __name__ == "__main__": main()
M
vite/vite.py
→
vite/vite.py
@@ -58,7 +58,7 @@ </body>
<footer> {{ footer }} - <p> © {{ author }} </p> + <p> {{ author }} </p> <footer> """)