一个简单和最小的静态站点生成器。
vite的Python项目详细描述
维生素
A simple and mnml static site generator that Just Works™
安装
$ pip install vite
用法
$ vite init path/to/project $ vite new blog/some-post.md # `pages/` is implied
这将创建pages/blog/some-post.md
。
然后:
$ vite build # in project directory
呈现的html将位于build
目录中。
最后,运行:
$ vite serve # also in the project directory
配置
不是很复杂,但是基本的配置可以使用
config.py
在项目目录中找到。
示例配置:
# config.py title=''author=''header=''footer=''template='index.html'# default is templates/index.htmlpost_build=[]# list of commands to run post-build
模板化
vite使用jinja2模板,因此模板文件必须放在单独的templates/
目录中。
一个基本的例子是:
<linkrel="stylesheet"href="/static/sakura-earthy.css"><title> {{ title }} </title><body> {{ body }} </body><footer> {{ footer }} </footer>
指定每页模板
vite允许每页指定一个唯一的模板。这是通过将yaml frontmatter包含在降价文件的顶部来实现的,例如:
--- template: foo.html title: Some fancy buzzwords here subtitle: Cool catch phrase here date: 2019-08-09 --- ## markdown here ...
模板化注释
- 可以从
static
文件夹访问样式表、图像和js。 index.html
,即您网站的主页,应该在pages/
目录中_index.md
。
目录树
example
├── build
├── config.py
├── pages
│ └── test.md
├── static
└── templates
└── index.html
待办事项
- [X]模板化
- [X]CSS支持
- [x]实现一个简单的http服务器(later)
- [X]添加示例站点
- [X]基本配置(
config.py
) - [X]分析每页选项的frontmatter(json、yaml、toml)
- [X]更好地支持主页(主页)
- [X]更强大的前沿内容(标题、日期、草稿状态等)(草稿状态不完整)
- []
在(不发生)pages/
下的较深目录(现在仅支持一个级别,否则中断) - []
标记系统(不发生)