all repos — py-vite @ 76fb5932c766901bf8556e04bb2bfa28ba6fd2ee

the original vite, written in python

feat: create_template() function
Anirudh icyph0x@protonmail.com
Fri, 13 Apr 2018 21:10:13 +0530
commit

76fb5932c766901bf8556e04bb2bfa28ba6fd2ee

parent

594cd73dc3c3210f5bf15b4423974d28923a2690

1 files changed, 24 insertions(+), 1 deletions(-)

jump to
M vite/vite.pyvite/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)))