最简单的静态网站生成器: Pagic
GitHub: https://github.com/xcatliu/pagic
最近很多地方用到了静态网站,但是 Jekyll 和 Hexo 都太重了,我完全不需要它的主题和博客文章功能,所以做了一个静态网站生成器的轮子,取名为 Pagic ,分享给大家。
The easiest way to generate static html page from markdown
特性
- 极简的使用方式:只需要
xxx.md和_layout.js即可 - 其他静态资源文件直接复制到 public 文件夹
- 支持 sub page 和 sub layout ,每个 Markdown 文件会一级一级往上查找,选择最近的
_layout.js作为模板 - 传入
relativeToRoot到模板中,方便插入静态资源如 css - 支持 cli 和 node modules 引入
3 回复
收藏
v0.4.0
Breaking Changes
- Use
pagic buildinstead ofpagic require('pagic')will return thePagicclass
New Features
_config.yml
We can set the configuration in _config.yml, the default is:
src_dir: src
public_dir: public
pagic build
We can use pagic build to build static page, there are some options while using build command:
pagic build [options]
# -w, --watch watch src dir change
# -s, --serve serve public dir
# -p, --port override default port
pagic init
We can use pagic init to create a new Pagic folder:
pagic init <dir>