all repos — py-vite @ 1efa6e0263169bfcf34cbbbd7fed158b66244255

the original vite, written in python

README.md (view raw)

  1# vite
  2> A simple and mnml static site generator that Just Works™
  3
  4<h1 align="center">
  5    <img width="750" src="https://0x0.st/swPG.png" alt="Vite demo">
  6</h1>
  7
  8Installation
  9------------
 10
 11```console
 12$ pip install vite
 13```
 14Usage
 15-----
 16
 17```console
 18$ vite init path/to/project
 19$ vite new blog/some-post.md   # `pages/` is implied
 20```
 21This creates `pages/blog/some-post.md`.
 22
 23And then:
 24```console
 25$ vite build   # in project directory
 26```
 27Rendered HTML will be in the `build` directory.
 28
 29Finally, run:
 30```console
 31$ vite serve  # also in the project directory
 32```
 33
 34Configuration
 35-------------
 36
 37Not very sophisticated, but basic configuration can be acheived using
 38  `config.py` found in the project directory.
 39Example config:
 40
 41```python
 42# config.py 
 43title = ''
 44author = ''
 45header = ''
 46footer = '' 
 47template = 'index.html'  # default is templates/index.html
 48post_build = []          # list of commands to run post-build
 49```
 50
 51Templating
 52----------
 53
 54Vite uses Jinja2 templating, so template files must be placed in a separate `templates/` directory.  
 55A basic example would be:
 56```html
 57<link rel="stylesheet" href="/static/sakura-earthy.css">
 58
 59<title> {{ title }} </title>
 60
 61<body>
 62{{ body }}
 63</body>
 64
 65<footer>
 66{{ footer }}
 67</footer>
 68```
 69### Specifying per-page templates
 70Vite allows for specifying a unique template, per page. This is acheived by including YAML frontmatter at the top of the Markdown file, like so:
 71
 72```markdown
 73---
 74template: foo.html
 75title: Some fancy buzzwords here
 76subtitle: Cool catch phrase here
 77date: 2019-08-09
 78---
 79
 80## markdown here
 81...
 82```
 83
 84### Notes on templating
 85
 86- Stylesheets, images and JS can be accessed from the `static` folder.
 87- `index.html`, i.e. your website's homepage, should be `_index.md` in the `pages/` directory.
 88
 89
 90Directory tree
 91--------------
 92
 93    example
 94    ├── build
 95    ├── config.py
 96    ├── pages
 97    │   └── test.md
 98    ├── static
 99    └── templates
100        └── index.html
101
102TODO
103----
104
105- [x] Templating
106- [x] CSS support
107- [x] Implement a simple HTTP server (*later*)
108- [x] Add example site
109- [x] Basic config (`config.py`)
110- [x] Parsing frontmatter (JSON, YAML, TOML) for per-page options
111- [x] Better support for home page (main `index.html` page)
112- [x] More powerful frontmatter (title, date, draft status, etc.) (draft status is incomplete)
113- [ ] ~Deeper directories under `pages/` (supports only one level now, breaks otherwise)~ (not happening)
114- [ ] ~Tagging system~ (not happening)
115