all repos — py-vite @ 209f69130fe18a23e2c83420ba7de2345d8c588d

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[![forthebadge](https://forthebadge.com/images/badges/60-percent-of-the-time-works-every-time.svg)](https://forthebadge.com)
  5[![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com)
  6[![forthebadge](https://forthebadge.com/images/badges/powered-by-electricity.svg)](https://forthebadge.com)
  7[![forthebadge](https://forthebadge.com/images/badges/uses-git.svg)](https://forthebadge.com)
  8
  9<h1 align="center">
 10    <img width="750" src="https://0x0.st/swPG.png" alt="Vite demo">
 11</h1>
 12
 13Installation
 14------------
 15
 16```console
 17$ pip install vite
 18```
 19Usage
 20-----
 21
 22```console
 23$ vite new <project-path>
 24```
 25Write your Markdown files in the `pages` directory and execute:
 26```console
 27$ vite build   # in project directory
 28```
 29Rendered HTML will be in the `build` directory.
 30
 31Finally, run:
 32```console
 33$ vite serve  # also in the project directory
 34```
 35to serve the contents of the `build` directory.
 36
 37Configuration
 38-------------
 39
 40Not very sophisticated, but basic configuration can be acheived using
 41  `config.py` found in the project directory.
 42Example config:
 43
 44```python
 45# config.py 
 46title = ''
 47author = ''
 48header = ''
 49footer = '' 
 50template = 'index.html'  # default is templates/index.html
 51```
 52
 53Templating
 54----------
 55
 56Vite uses Jinja2 templating, so template files must be placed in a separate `templates/` directory.  
 57A basic example would be:
 58```html
 59<link rel="stylesheet" href="/static/sakura-earthy.css">
 60
 61<title> {{ title }} </title>
 62
 63<body>
 64{{ body }}
 65</body>
 66
 67<footer>
 68{{ footer }}
 69</footer>
 70```
 71### Specifying per-page templates
 72Vite allows for specifying a unique template, per page. This is acheived by including YAML frontmatter at the top of the Markdown file, like so:
 73
 74```markdown
 75---
 76template: foo.html
 77---
 78
 79## markdown here
 80...
 81```
 82
 83### Notes on templating
 84
 85- Stylesheets, images and JS can be accessed from the `static` folder.
 86- `index.html`, i.e. your website's homepage, should be `_index.md` in the `pages/` directory.
 87
 88
 89Directory tree
 90--------------
 91
 92    example
 93    ├── build
 94    ├── config.py
 95    ├── pages
 96    │   └── test.md
 97    ├── static
 98    └── templates
 99        └── index.html
100
101TODO
102----
103
104- [x] Templating
105- [x] CSS support
106- [x] Implement a simple HTTP server (*later*)
107- [x] Add example site
108- [x] Basic config (`config.py`)
109- [x] Parsing frontmatter (JSON, YAML, TOML) for per-page options
110- [x] Better support for home page (main `index.html` page)
111
112
113## Credits
114Logo credits: <a href="http://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a>  
115Hue: [s0md3v/hue](https://github.com/UltimateHackers/hue)
116