all repos — py-vite @ master

the original vite, written in python

d383e6ea
Fix readme
Anirudh Oppiliappan x@icyphox.sh
Fri, 30 Oct 2020 20:51:03 +0530
bac24d13
Add note about go-vite
Anirudh Oppiliappan x@icyphox.sh
Fri, 30 Oct 2020 20:21:11 +0530
1ca450f9
Update setup.py with correct readme

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Sat, 30 May 2020 13:49:46 +0530

vite

A simple and mnml static site generator that Just Works™

NOTE: Ths project has been superseded by go-vite.

Installation

$ pip install git+https://github.com/icyphox/vite

Note: the PyPI version is out of date, and likely won’t be updated. I can’t be bothered.

Usage

$ vite init path/to/project
$ vite new blog/some-post.md   # `pages/` is implied

This creates pages/blog/some-post.md.

And then:

$ vite build   # in project directory

Rendered HTML will be in the build directory.

Finally, run:

$ vite serve  # also in the project directory

Configuration

Not very sophisticated, but basic configuration can be acheived using config.py found in the project directory. Example config:

# config.py 
title = ''
author = ''
header = ''
footer = '' 
template = 'index.html'  # default is templates/index.html
pre_build = []           # list of commands to run pre-build
post_build = []          # list of commands to run post-build

Templating

Vite uses Jinja2 templating, so template files must be placed in a separate templates/ directory.
A basic example would be:

<link rel="stylesheet" href="/static/sakura-earthy.css">

<title> {{ title }} </title>

<body>
{{ body }}
</body>

<footer>
{{ footer }}
</footer>

Specifying per-page templates

Vite allows for specifying a unique template, per page. This is acheived by including YAML frontmatter at the top of the Markdown file, like so:

---
template: foo.html
title: Some fancy buzzwords here
subtitle: Cool catch phrase here
url: my-post
date: 2019-08-09
---

## markdown here
...

Notes on templating

Directory tree

example
├── build
├── config.py
├── pages
│   └── test.md
├── static
└── templates
    └── index.html

TODO

clone
git clone https://git.icyphox.sh/py-vite