helloandre/pressing

静态网站生成的可扩展库

0.1.1 2016-04-18 05:19 UTC

This package is not auto-updated.

Last update: 2024-09-26 00:10:06 UTC


README

PHP的静态网站生成器库。

安装

composer install helloandre/pressing

使用

$config = [];
$pressing = new Pressing\Pressing;
$pressing->generate($config);

配置

Pressing配置

output_dir - 默认: public/ - 生成的输出将存放的位置。

input_dir - 默认: src/ - Pressing将在其中查找要移动到output_dir的文件。

template_engine - 默认: Twig - 用于渲染模板的引擎。

template_dir - 默认: templates/ - 模板所在的位置。

Frontmatter

每个文件都可能包含一个Frontmatter配置,该配置位于文件顶部的三个短横线和底部的三个短横线标记之间的JSON格式。

只有在找到Frontmatter的情况下,文件才会通过模板引擎运行。

---
{ ... }
---
...

或为空

---
---
...

Frontmatter中的任何数据都将传递给模板。

特殊Frontmatter

template - 默认: none - 声明要使用哪个模板。

模板引擎

当前可用的模板引擎