all repos — py-vite @ bac24d13ccba14c6b7d5169503531d35a138be76

the original vite, written in python

readme.md (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
# vite
> A simple and mnml static site generator that Just Works™

**NOTE**: Ths project has been superseded by
[go-vite](/icyphox/go-vite).

Installation
------------

```console
$ 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
-----

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

And then:
```console
$ vite build   # in project directory
```
Rendered HTML will be in the `build` directory.

Finally, run:
```console
$ 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:

```python
# 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:
```html
<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:

```markdown
---
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

- Stylesheets, images and JS can be accessed from the `static` folder.
- `index.html`, i.e. your website's homepage, should be `_index.md` in the `pages/` directory.


Directory tree
--------------

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

TODO
----

- [x] Templating
- [x] CSS support
- [x] Implement a simple HTTP server (*later*)
- [x] Add example site
- [x] Basic config (`config.py`)
- [x] Parsing frontmatter (JSON, YAML, TOML) for per-page options
- [x] Better support for home page (main `index.html` page)
- [x] More powerful frontmatter (title, date, draft status, etc.) (draft status is incomplete)
- [ ] ~Deeper directories under `pages/` (supports only one level now, breaks otherwise)~ (not happening)
- [ ] ~Tagging system~ (not happening)