feat: create_template() function
Anirudh icyph0x@protonmail.com
Fri, 13 Apr 2018 21:10:13 +0530
1 files changed,
24 insertions(+),
1 deletions(-)
jump to
M
vite/vite.py
→
vite/vite.py
@@ -58,10 +58,33 @@ template = 'index.html' # default is index.html
""") +def create_template(path): + with open(os.path.join(path, 'templates', 'index.html'), 'w') as f: + f.write(""" +<!DOCTYPE html> +<html> +<header> + {{ header }} + <title> + {{ title }} + </title> +</header> + +<body> + {{ body }} +</body> + +<footer> + {{ footer }} + <p> © {{ author }} </p> +<footer> + """) + + def build_project(path): try: os.chdir(path) - importlib.import_module('make') + importlib.import_module('.make') except FileNotFoundError as e: print(bad('Error: no such file or directory: %s' % (path)))